Advertisement
Advertisement
| 05.03.2008 at 08:36PM PDT, ID: 23374509 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: |
#!/usr/bin/perl
my($mytime) = time();
my($t1) = time();
my($t2);
my($version) = "1.1o";
my($debug) = 0;
my($pageTitle) = 'Not Specified';
&parseForm;
$subDir = 1;
$listDirs = 0;
if ($FORM{'debug'} ne "") { $debug = 1; }
$FORM{'log'} = "Changed.log";
if ($FORM{'log'} ne "") { &writeLog; }
$FORM{'base'} = "/home/tompatterson2/public_html";
if ($FORM{'base'} eq "") { myError( "base not passed." ); }
$FORM{'rbase'} = "http://208.109.117.138";
if ($FORM{'rbase'} eq "") { myError("rbase not passed." ); }
if ($FORM{'sortmode'} eq "") { $FORM{'sortmode'} = '1' };
if ($FORM{'ndays'} eq "") { $FORM{'ndays'} = '7' };
$FORM{'dirs'} = "/AirstreamList;/Digests;/Family;/Sailing;/Silverstreak;/Streamline;/Trailers;/VAC/MHonArc;";
if ($FORM{'dirs'} ne "") {
@directories = split( /;/,$FORM{'dirs'});
$listDirs = 1;
$FORM{'dosub'} = "yes";
}
if ($FORM{'rbase'} ne "") { $pageTitle = $FORM{'rbase'} };
if ($FORM{'title'} ne "") { $pageTitle = $FORM{'title'} };
$excdirs = 0;
if ($FORM{'excdirs'} ne "") {
@excpaths = split(/;/,$FORM{'excdirs'});
$excdirs = 1;
}
if (lc($FORM{'dosub'}) eq "no") { $subDir = 0; }
$mytime = $mytime - ($FORM{'ndays'} * 86400 );
&htmlTop;
if ($listDirs > 0) {
foreach $dir (@directories) {
&checkFiles($FORM{'base'}."$dir");
}
} else {
&checkFiles($FORM{'base'});
}
if ($FORM{'sortmode'} eq '1') {
foreach $key ( sort ( keys( %DATA ) ) ) {
printDetails( $DATA{$key} );
}
} elsif ($FORM{'sortmode'} eq '2') {
foreach $key ( sort { $b cmp $a} ( keys( %DATA ) ) ) {
printDetails( $DATA{$key} );
}
} else {
foreach $key ( ( keys( %DATA ) ) ) {
printDetails( $DATA{$key} );
}
}
&htmlBottom;
exit;
sub printDetails {
my($line) = shift;
($fullFilename,$title,$date,$update) = split( /<>/ , $line);
print "<TR><TD><A HREF=\"$fullFilename\">$title</A>";
if ($update ne "") {
print "<BR><EM> Changes: </EM>$update\n";
}
print "</TD><TD ALIGN=\"Right\"><CODE>";
print "$date</CODE></TD></TR>\n";
}
sub checkFiles {
my($base) = shift;
my($fullFilename);
my(@lines);
my($title);
my($modtime);
my($myexit);
opendir(ROOT,$base);
@lines = readdir(ROOT);
closedir(ROOT);
foreach (@lines) {
next if /^\.|\.\.$/;
$fullFilename = "$base/$_";
if (-d $fullFilename) {
if($subDir > 0) {
$ok2dosub = 1;
if ($excdirs > 0) {
$tmp = $fullFilename;
$tmp =~ s/$FORM{'base'}//;
foreach $tpath (@excpaths) {
if ($tmp eq $tpath) { $ok2dosub = 0; }
}
}
if ($ok2dosub > 0) { checkFiles( $fullFilename) };
}
next;
}
if (!($fullFilename =~ m/\.htm/i || $fullFilename =~ m/\.sht/i)) { next; }
$modTime = (stat($fullFilename))[9];
if ($debug > 0) {
print "<TR><TD>$modTime</TD><TD>";
print ($modTime-$mytime);
print "</TD><TD>";
if ($modTime < $mytime) {
print "fail";
} else {
print "pass";
}
print "</TD><TD>$fullFilename</TD></TR>\n";
next;
}
$myexit = "0";
if ($modTime < $mytime) { next; }
$title = "Untitled";
$update = "";
$data = '';
open(FILE,$fullFilename);
while( $line = <FILE> ) {
$line =~ s!\n!!ge;
$line =~ s!\r!!ge;
$data = $data . $line . ' ';
}
close(FILE);
if ($data =~ m!<title>(.+)</title>!i) { $title = $1; }
if ($data =~ m!<\!-- update: (.+) -->!i) { $update = $1; }
if ($data =~ m/<!-- nosearch -->/i) { $myexit = "1"; }
if ($myexit eq "1") { next; }
$fullFilename =~ s/$FORM{'base'}//g;
$fullFilename = "$FORM{'rbase'}$fullFilename";
$fullFilename =~ s/index\.html//ge;
$date = localtime($modTime);
$ndate = niceDate($date);
$sdate = sortDate($date);
$DATA{"$sdate$fullFilename"} = "$fullFilename<>$title<>$ndate<>$update";
}
}
sub niceDate {
my($date) = shift;
my($myDate);
$myDate = substr($date,0,3). " ". substr($date, 8,2)."/".substr($date,4,3)."/".substr($date,20,4);
$myDate = "$myDate ".substr($date,11,8);
$myDate =~ s/ / /gi;
return $myDate;
}
sub parseForm {
my($key,$value);
my($buffer);
my(@lines);
my($line);
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if ($buffer eq "") { $buffer = $ENV{'QUERY_STRING'}; }
@lines = split( /&/, $buffer);
foreach $line (@lines) {
chomp($line);
chomp($line);
chomp($line);
chomp($line);
($key,$value) = split( /=/,$line);
$key = lc($key);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$value =~ s/\n//g;
$value =~ s/\r/ /g;
$value =~ s/</</g;
$value =~ s/>/>/g;
$FORM{$key} = $value;
}
if ($FORM{'uname'} ne "") {
$FORM{'base'} = "/usr/people/patrol/premium/$FORM{'uname'}/User_html";
$FORM{'rbase'} = "/~$FORM{'uname'}";
}
}
sub myError {
my($errmsg) = shift;
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>jawhatschanged.pl - Error</TITLE></HEAD><BODY>\n";
print "<H1>jawhatschanged.pl</H1>\n";
print "The following error occured<P>\n";
print "<LI>$errmsg";
print "</BODY></HTML>\n";
exit;
}
sub writeLog {
my($site);
$site = $ENV{'REMOTE_HOST'};
if ($site eq "") { $site = $ENV{'REMOTE_ADDR'}; }
if (!(-e "$FORM{'log'}" )) {
open( OUTFILE,">$FORM{'log'}") or return;
print OUTFILE "\"time\",\"remote site\"\n";
close(OUTFILE);
}
open( OUTFILE,">>$FORM{'log'}") or return;
print OUTFILE "\"" . localtime() . "\",\"$site\"\n";
close( OUTFILE );
}
sub htmlTop {
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Whats Changed in $pageTitle</TITLE></HEAD>\n";
&doBody;
print "<CENTER><H1><font color=blue>Whats Changed This Week In<BR>$pageTitle</font></H1></CENTER><HR>\n";
print '<script src="/staticlogo.js"></script>';
print "Files modified since: ";
$date = localtime( $mytime );
print niceDate($date) . "<P>\n";
print "<TABLE WIDTH=\"100%\">\n";
print "<TR><TH ALIGN=\"Left\">Document</TH><TH ALIGN=\"right\">Last Modified</TH></TR>\n";
if ($debug > 0) {
print "<UL><LI>mytime = $mytime</UL><BR>\n";
print "<TABLE BORDER=1>\n";
}
}
sub htmlBottom {
if ($debug > 0) {
print "</TABLE>\n";
}
$t2 = time();
print "</TABLE>\n";
print "<HR>\n<TABLE WIDTH=\"100%\"><TR>\n<TD WIDTH=\"33%\" ALIGN=\"Left\">";
print "<FONT SIZE=2>Copyright © 1997 <A HREF=\"http://www.ufbs.co.uk/jason/\">Jason Anthony</A></FONT>";
print "</TD>\n<TD ALIGN=\"center\"><FONT SIZE=2>jawhatschanged.pl V$version</FONT></TD>\n";
print "<TD WIDTH=\"33%\" ALIGN=\"Right\"><FONT SIZE=2>Time Taken: ";
print $t2-$t1;
print " second";
if ($t2-$t1 == 1) { print "."; } else { print "s."; }
print "</FONT></TD>\n</TR></TABLE>\n";
print "</BODY></HTML>\n";
}
sub doBody {
my($line) = "<BODY";
$FORM{'background'} ="/images/pap24.gif";
if ($FORM{'background'} ne "") { $line = "$line BACKGROUND=\"$FORM{'background'}\""; }
if ($FORM{'bgcolor' } ne "") { $line = "$line BGCOLOR=\"$FORM{'bgcolor'}\""; }
if ($FORM{'text' } ne "") { $line = "$line TEXT=\"$FORM{'text'}\""; }
if ($FORM{'link' } ne "") { $line = "$line LINK=\"$FORM{'link'}\""; }
if ($FORM{'alink' } ne "") { $line = "$line ALINK=\"$FORM{'alink'}\""; }
if ($FORM{'vlink' } ne "") { $line = "$line VLINK=\"$FORM{'vlink'}\""; }
$line = "$line>\n";
print $line;
}
sub sortDate {
my($date) = shift;
my($myDate);
$myDate = substr($date,20,4);
if (lc(substr($date,4,3)) eq "jan") { $myDate = $myDate . "01"; }
if (lc(substr($date,4,3)) eq "feb") { $myDate = $myDate . "02"; }
if (lc(substr($date,4,3)) eq "mar") { $myDate = $myDate . "03"; }
if (lc(substr($date,4,3)) eq "apr") { $myDate = $myDate . "04"; }
if (lc(substr($date,4,3)) eq "may") { $myDate = $myDate . "05"; }
if (lc(substr($date,4,3)) eq "jun") { $myDate = $myDate . "06"; }
if (lc(substr($date,4,3)) eq "jul") { $myDate = $myDate . "07"; }
if (lc(substr($date,4,3)) eq "aug") { $myDate = $myDate . "08"; }
if (lc(substr($date,4,3)) eq "sep") { $myDate = $myDate . "09"; }
if (lc(substr($date,4,3)) eq "oct") { $myDate = $myDate . "10"; }
if (lc(substr($date,4,3)) eq "nov") { $myDate = $myDate . "11"; }
if (lc(substr($date,4,3)) eq "dec") { $myDate = $myDate . "12"; }
$myDate = $myDate . substr($date,8,2) . substr($date,11,8);
$myDate =~ tr/ /0/;
return $myDate;
}
|