function mlog($function, $fatal, $action) { $query = "insert into logs (stamp,function,fatal,action) values(NOW(),'{$function}','{$fatal}','{$action}')"; mque($query); if ($fatal) { die("\n\nFatal Error: {$function} produced a fatal error: {$action}\n\n"); } }
function write_analog($bash, $domain) { exec("echo '# You REALLY shoud have NO NEED to modify this file.\n# If you mess up the configuration, your website analysis will STOP WORKING!\n# Advanced user only please! Contact Gabe or Bob with questions!\n# This script is automatically run everyday at 11:30 PM\n#\n# Goto http://www.rix-web.com/analyzer/ for an automatic configuration file maker!\n#\nLOGFILE /home/{$bash}/logs/*access.log\nOUTPUT HTML\nOUTFILE /home/{$bash}/www/www/admin/analog/index.html\nHOSTNAME \"{$domain}\"\nHOSTURL http://www.{$domain}\nIMAGEDIR ../../images/\nDNS LOOKUP\nREQINCLUDE pages\nREQLINKINCLUDE pages\nREFLINKINCLUDE *\nREDIRREFLINKINCLUDE *\nFAILREFLINKINCLUDE *\nSUBBROW */*\nSUBTYPE *.gz,*.Z\n\nPAGEINCLUDE *.php\n\n# More SEARCHENGINE commands can be found at\n# http://www.analog.cx/helpers/#conffiles\nSEARCHENGINE http://*google.*/* q,as_q,as_epq,as_oq\nSEARCHENGINE http://*altavista.*/* q\nSEARCHENGINE http://*yahoo.*/* p\nSEARCHENGINE http://*lycos.*/* query,wfq\nSEARCHENGINE http://*aol.*/* query\nSEARCHENGINE http://*excite.*/* search\nSEARCHENGINE http://*go2net.*/* general\nSEARCHENGINE http://*metacrawler.*/* general\nSEARCHENGINE http://*msn.*/* q,MT\nSEARCHENGINE http://*netscape.*/* search\nSEARCHENGINE http://*looksmart.*/* key\nSEARCHENGINE http://*webcrawler.*/* qkw,search,searchText\nSEARCHENGINE http://*overture.*/* Keywords\nSEARCHENGINE http://*teoma.*/* q\nSEARCHENGINE http://*infospace.*/* qkw\nSEARCHENGINE http://*alltheweb.*/* q\nSEARCHENGINE http://*dogpile.*/* q\nSEARCHENGINE http://*ask.*/* ask\nSEARCHENGINE http://*alltheweb.*/* query\nSEARCHENGINE http://*northernlight.*/* qr\nSEARCHENGINE http://*nlsearch.*/* qr\nSEARCHENGINE http://*dmoz.*/* search\nSEARCHENGINE http://*/netfind* query\nSEARCHENGINE http://*/pursuit query\nROBOTINCLUDE REGEXPI:robot\nROBOTINCLUDE REGEXPI:spider\nROBOTINCLUDE REGEXPI:crawler\nROBOTINCLUDE Googlebot*\nROBOTINCLUDE Infoseek*\nROBOTINCLUDE Scooter*\nROBOTINCLUDE *Slurp*\nROBOTINCLUDE *Validator*\nROBOTINCLUDE Ultraseek*\nTYPEALIAS .html \".html [Hypertext Markup Language]\"\nTYPEALIAS .htm \".htm [Hypertext Markup Language]\"\nTYPEALIAS .shtml \".shtml [Server-parsed HTML]\"\nTYPEALIAS .ps \".ps [PostScript]\"\nTYPEALIAS .gz \".gz [Gzip compressed files]\"\nTYPEALIAS .tar.gz \".tar.gz [Compressed archives]\"\nTYPEALIAS .jpg \".jpg [JPEG graphics]\"\nTYPEALIAS .jpeg \".jpeg [JPEG graphics]\"\nTYPEALIAS .gif \".gif [GIF graphics]\"\nTYPEALIAS .png \".png [PNG graphics]\"\nTYPEALIAS .txt \".txt [Plain text]\"\nTYPEALIAS .cgi \".cgi [CGI scripts]\"\nTYPEALIAS .pl \".pl [Perl scripts]\"\nTYPEALIAS .css \".css [Cascading Style Sheets]\"\nTYPEALIAS .class \".class [Java class files]\"\nTYPEALIAS .pdf \".pdf [Adobe Portable Document Format]\"\nTYPEALIAS .zip \".zip [Zip archives]\"\nTYPEALIAS .hqx \".hqx [Macintosh BinHex files]\"\nTYPEALIAS .exe \".exe [Executables]\"\nTYPEALIAS .wav \".wav [WAV sound files]\"\nTYPEALIAS .avi \".avi [AVI movies]\"\nTYPEALIAS .arc \".arc [Compressed archives]\"\nTYPEALIAS .mid \".mid [MIDI sound files]\"\nTYPEALIAS .mp3 \".mp3 [MP3 sound files]\"\nTYPEALIAS .ogg \".ogg [OGG sound files]\"\nTYPEALIAS .doc \".doc [Microsoft Word document]\"\nTYPEALIAS .rtf \".rtf [Rich Text Format]\"\nTYPEALIAS .mov \".mov [Quick Time movie]\"\nTYPEALIAS .mpg \".mpg [MPEG movie]\"\nTYPEALIAS .mpeg \".mpeg [MPEG movie]\"\nTYPEALIAS .asp \".asp [Active Server Pages]\"\nTYPEALIAS .jsp \".jsp [Java Server Pages]\"\nTYPEALIAS .cfm \".cfm [Cold Fusion]\"\nTYPEALIAS .php \".php [PHP]\"\nTYPEALIAS .js \".js [JavaScript code]\"' > /home/{$bash}/etc/analog.conf"); exec("chmod 640 /home/{$bash}/etc/analog.conf"); // copy over image files to analog directory exec("cp /usr/share/analog/images/* /home/{$bash}/www/www/admin/analog/images/"); // grab all domains and re-write analog cronjob if (!($results = mque("select * from domains"))) { mlog("add.writeanalog", !FATAL, "Could not find any domains to write!"); } $cron = "#!/bin/sh\n\n"; while ($domain = mysql_fetch_array($results)) { $cron = $cron . "/usr/bin/analog -G +g/home/" . $domain['bash'] . "/etc/analog.conf 2> /dev/null\n"; $cron = $cron . "/root/bin/analogtidy " . $domain['bash'] . " " . $domain['domain'] . "\n"; } // write file and set default permissions exec("echo '{$cron}' > /etc/cron.daily/analog"); exec("chmod 755 /etc/cron.daily/analog"); }