/PageRoot.cpp
C++ | 3434 lines | 1560 code | 341 blank | 1533 comment | 205 complexity | c7c3cacbb1af6425871752ada1930fa5 MD5 | raw file
Possible License(s): Apache-2.0
Large files files are truncated, but you can click here to view the full file
- #include "gb-include.h"
- #include "Indexdb.h" // makeKey(int64_t docId)
- #include "Titledb.h"
- #include "Spider.h"
- #include "Tagdb.h"
- #include "Dns.h"
- //#include "PageResults.h" // for query buf, g_qbuf
- #include "Collectiondb.h"
- //#include "CollectionRec.h"
- #include "Clusterdb.h" // for getting # of docs indexed
- //#include "Checksumdb.h" // should migrate to this one, though
- #include "Pages.h"
- #include "Query.h" // MAX_QUERY_LEN
- #include "SafeBuf.h"
- #include "LanguageIdentifier.h"
- #include "LanguagePages.h"
- #include "Users.h"
- #include "Address.h" // getIPLocation
- #include "Proxy.h"
- //char *printNumResultsDropDown ( char *p, int32_t n, bool *printedDropDown);
- bool printNumResultsDropDown ( SafeBuf& sb, int32_t n, bool *printedDropDown);
- //static char *printTopDirectory ( char *p, char *pend );
- static bool printTopDirectory ( SafeBuf& sb , char format );
- // this prints the last five queries
- //static int32_t printLastQueries ( char *p , char *pend ) ;
- //static char *expandRootHtml ( char *p , int32_t plen ,
- /*
- static bool expandRootHtml ( SafeBuf& sb,
- uint8_t *html , int32_t htmlLen ,
- char *q , int32_t qlen ,
- HttpRequest *r ,
- TcpSocket *s ,
- int64_t docsInColl ,
- CollectionRec *cr ) ;
- */
- bool sendPageRoot ( TcpSocket *s, HttpRequest *r ){
- return sendPageRoot ( s, r, NULL );
- }
- bool printNav ( SafeBuf &sb , HttpRequest *r ) {
- /*
- char *root = "";
- char *rootSecure = "";
- if ( g_conf.m_isMattWells ) {
- root = "http://www.gigablast.com";
- rootSecure = "https://www.gigablast.com";
- }
- sb.safePrintf("<center><b><p class=nav>"
- "<a href=%s/about.html>About</a>"
- " "
- "<a href=%s/contact.html>Contact</a>"
- " "
- "<a href=%s/help.html>Help</a>"
- " "
- "<a href=%s/privacy.html>Privacy Policy</a>"
- " "
- // TODO: API page must also provide a description
- // of the output... like searchfeed.html does already.
- // put that in the api page as well.
- "<a href=%s/api>API</a>"
- , root
- , root
- , root
- , root
- , root
- );
- if ( g_conf.m_isMattWells )
- sb.safePrintf(" "
- "<a href=%s/seoapi.html>SEO API</a>"
- " "
- "<a href=%s/account>My Account</a> "
- , root
- , rootSecure
- //" <a href=/logout>Logout</a>"
- );
- //if ( r->isLocal() )
- sb.safePrintf(" [<a style=color:green; "
- "href=\"/admin/settings\">"
- "Admin</a>]");
- sb.safePrintf("</p></b></center>");
- */
- sb.safePrintf("</TD></TR></TABLE>"
- "</body></html>");
- return true;
- }
- //////////////
- //
- // BEGIN expandHtml() helper functions
- //
- //////////////
- bool printFamilyFilter ( SafeBuf& sb , bool familyFilterOn ) {
- char *s1 = "";
- char *s2 = "";
- if ( familyFilterOn ) s1 = " checked";
- else s2 = " checked";
- //p += sprintf ( p ,
- return sb.safePrintf (
- "Family filter: "
- "<input type=radio name=ff value=1%s>On "
- "<input type=radio name=ff value=0%s>Off " ,
- s1 , s2 );
- //return p;
- }
- //char *printNumResultsDropDown ( char *p , int32_t n , bool *printedDropDown ) {
- bool printNumResultsDropDown ( SafeBuf& sb , int32_t n , bool *printedDropDown ) {
- if ( n!=10 && n!=20 && n!=30 && n!=50 && n!=100 )
- //return p;
- return true;
- *printedDropDown = true;
- char *d1 = "";
- char *d2 = "";
- char *d3 = "";
- char *d4 = "";
- char *d5 = "";
- if ( n == 10 ) d1 = " selected";
- if ( n == 20 ) d2 = " selected";
- if ( n == 30 ) d3 = " selected";
- if ( n == 50 ) d4 = " selected";
- if ( n ==100 ) d5 = " selected";
- //p += sprintf ( p ,
- return sb.safePrintf (
- "<select name=n>\n"
- "<option value=10%s>10\n"
- "<option value=20%s>20\n"
- "<option value=30%s>30\n"
- "<option value=50%s>50\n"
- "<option value=100%s>100\n"
- "</select>",
- d1,d2,d3,d4,d5);
- //return p;
- }
- //char *printDirectorySearchType ( char *p, int32_t sdirt ) {
- bool printDirectorySearchType ( SafeBuf& sb, int32_t sdirt ) {
- // default to entire directory
- if (sdirt < 1 || sdirt > 4)
- sdirt = 3;
- // by default search the whole thing
- sb.safePrintf("<input type=\"radio\" name=\"sdirt\" value=\"3\"");
- if (sdirt == 3) sb.safePrintf(" checked>");
- else sb.safePrintf(">");
- sb.safePrintf("Entire Directory<br>\n");
- // entire category
- sb.safePrintf("<input type=\"radio\" name=\"sdirt\" value=\"1\"");
- if (sdirt == 1) sb.safePrintf(" checked>");
- else sb.safePrintf(">");
- sb.safePrintf("Entire Category<br>\n");
- // base category only
- sb.safePrintf("<nobr><input type=\"radio\" name=\"sdirt\" value=\"2\"");
- if (sdirt == 2) sb.safePrintf(" checked>");
- else sb.safePrintf(">");
- sb.safePrintf("Pages in Base Category</nobr><br>\n");
- // sites in base category
- sb.safePrintf("<input type=\"radio\" name=\"sdirt\" value=\"7\"");
- if (sdirt == 7) sb.safePrintf(" checked>");
- else sb.safePrintf(">");
- sb.safePrintf("Sites in Base Category<br>\n");
- // sites in entire category
- sb.safePrintf("<input type=\"radio\" name=\"sdirt\" value=\"6\"");
- if (sdirt == 6) sb.safePrintf(" checked>");
- else sb.safePrintf(">");
- sb.safePrintf("Sites in Entire Category<br>\n");
- // end it
- return true;
- }
- #include "SearchInput.h"
- bool printRadioButtons ( SafeBuf& sb , SearchInput *si ) {
- // don't display this for directory search
- // look it up. returns catId <= 0 if dmoz not setup yet.
- // From PageDirectory.cpp
- //int32_t catId= g_categories->getIdFromPath(decodedPath, decodedPathLen);
- // if /Top print the directory homepage
- //if ( catId == 1 || catId <= 0 )
- // return true;
- // site
- /*
- if ( si->m_siteLen > 0 ) {
- // . print rest of search box etc.
- // . print cobranding radio buttons
- //if ( p + si->m_siteLen + 1 >= pend ) return p;
- //p += sprintf ( p ,
- return sb.safePrintf (
- //" "
- //"<font size=-1>"
- //"<b><a href=\"/\"><font color=red>"
- //"Powered by Gigablast</font></a></b>"
- //"<br>"
- //"<tr align=center><td></td><td>"
- "<input type=radio name=site value=\"\">"
- "Search the Web "
- "<input type=radio name=site "
- "value=\"%s\" checked>Search %s" ,
- //"</td></tr></table><br>"
- //"</td></tr>"
- //"<font size=-1>" ,
- si->m_site , si->m_site );
- }
- else if ( si->m_sitesLen > 0 ) {
- */
- if ( si->m_sites && si->m_sites[0] ) {
- // . print rest of search box etc.
- // . print cobranding radio buttons
- //if ( p + si->m_sitesLen + 1 >= pend ) return p;
- // if not explicitly instructed to print all sites
- // and they are a int32_t list, do not print all
- /*
- char tmp[1000];
- char *x = si->m_sites;
- if ( si->m_sitesLen > 255){//&&!st->m_printAllSites){
- // copy what's there
- strncpy ( tmp , si->m_sites , 255 );
- x = tmp + 254 ;
- // do not hack off in the middle of a site
- while ( is_alnum(*x) && x > tmp ) x--;
- // overwrite it with [more] link
- //x += sprintf ( x , "<a href=\"/search?" );
- // our current query parameters
- //if ( x + uclen + 10 >= xend ) goto skipit;
- sprintf ( x , " ..." );
- x = tmp;
- }
- */
- //p += sprintf ( p ,
- sb.safePrintf (
- //" "
- //"<font size=-1>"
- //"<b><a href=\"/\"><font color=red>"
- //"Powered by Gigablast</font></a></b>"
- //"<br>"
- //"<tr align=center><td></td><td>"
- "<input type=radio name=sites value=\"\">"
- "Search the Web "
- "<input type=radio name=sites "
- "value=\"%s\" checked>Search ",
- //"</td></tr></table><br>"
- //"</td></tr>"
- //"<font size=-1>" ,
- si->m_sites );
- sb.safeTruncateEllipsis ( si->m_sites, 255 );
- }
- return true;
- }
- bool printLogo ( SafeBuf& sb , SearchInput *si ) {
- // if an image was provided...
- if ( ! si->m_imgUrl || ! si->m_imgUrl[0] ) {
- // no, now we default to our logo
- //return true;
- //p += sprintf ( p ,
- return sb.safePrintf (
- "<a href=\"/\">"
- "<img valign=top width=250 height=61 border=0 "
- // avoid https for this, so make it absolute
- "src=\"/logo-med.jpg\"></a>" );
- //return p;
- }
- // do we have a link?
- if ( si->m_imgLink && si->m_imgLink[0])
- //p += sprintf ( p , "<a href=\"%s\">",si->m_imgLink);
- sb.safePrintf ( "<a href=\"%s\">", si->m_imgLink );
- // print image width and length
- if ( si->m_imgWidth >= 0 && si->m_imgHeight >= 0 )
- //p += sprintf ( p , "<img width=%"INT32" height=%"INT32" ",
- sb.safePrintf( "<img width=%"INT32" height=%"INT32" ",
- si->m_imgWidth , si->m_imgHeight );
- else
- //p += sprintf ( p , "<img " );
- sb.safePrintf ( "<img " );
- //p += sprintf ( p , "border=0 src=\"%s\">",
- sb.safePrintf( "border=0 src=\"%s\">",
- si->m_imgUrl );
- // end the link if we had one
- if ( si->m_imgLink && si->m_imgLink[0] )
- //p += sprintf ( p , "</a>");
- sb.safePrintf ( "</a>");
- return true;
- }
- /////////////
- //
- // END expandHtml() helper functions
- //
- /////////////
- bool expandHtml ( SafeBuf& sb,
- char *head ,
- int32_t hlen ,
- char *q ,
- int32_t qlen ,
- HttpRequest *r ,
- SearchInput *si,
- char *method ,
- CollectionRec *cr ) {
- //char *pend = p + plen;
- // store custom header into buf now
- //for ( int32_t i = 0 ; i < hlen && p+10 < pend ; i++ ) {
- for ( int32_t i = 0 ; i < hlen; i++ ) {
- if ( head[i] != '%' ) {
- // *p++ = head[i];
- sb.safeMemcpy((char*)&head[i], 1);
- continue;
- }
- if ( i + 1 >= hlen ) {
- // *p++ = head[i];
- sb.safeMemcpy((char*)&head[i], 1);
- continue;
- }
- if ( head[i+1] == 'S' ) {
- // now we got the %S, insert "spiders are [on/off]"
- bool spidersOn = true;
- if ( ! g_conf.m_spideringEnabled ) spidersOn = false;
- if ( ! cr->m_spideringEnabled ) spidersOn = false;
- if ( spidersOn )
- sb.safePrintf("Spiders are on");
- else
- sb.safePrintf("Spiders are off");
- // skip over %S
- i += 1;
- continue;
- }
- if ( head[i+1] == 'q' ) {
- // now we got the %q, insert the query
- char *p = (char*) sb.getBuf();
- char *pend = (char*) sb.getBufEnd();
- int32_t eqlen = dequote ( p , pend , q , qlen );
- //p += eqlen;
- sb.incrementLength(eqlen);
- // skip over %q
- i += 1;
- continue;
- }
- if ( head[i+1] == 'c' ) {
- // now we got the %q, insert the query
- if ( cr ) sb.safeStrcpy(cr->m_coll);
- // skip over %c
- i += 1;
- continue;
- }
- if ( head[i+1] == 'w' &&
- head[i+2] == 'h' &&
- head[i+3] == 'e' &&
- head[i+4] == 'r' &&
- head[i+5] == 'e' ) {
- // insert the location
- int32_t whereLen;
- char *where = r->getString("where",&whereLen);
- // get it from cookie as well!
- if ( ! where )
- where = r->getStringFromCookie("where",
- &whereLen);
- // fix for getStringFromCookie
- if ( where && ! where[0] ) where = NULL;
- // skip over the %where
- i += 5;
- // if empty, base it on IP
- if ( ! where ) {
- double lat;
- double lon;
- double radius;
- char *city,*state,*ctry;
- // use this by default
- int32_t ip = r->m_userIP;
- // ip for testing?
- int32_t iplen;
- char *ips = r->getString("uip",&iplen);
- if ( ips ) ip = atoip(ips);
- // returns true if found in db
- char buf[128];
- getIPLocation ( ip ,
- &lat ,
- &lon ,
- &radius,
- &city ,
- &state ,
- &ctry ,
- buf ,
- 128 ) ;
- if ( city && state )
- sb.safePrintf("%s, %s",city,state);
- }
- else
- sb.dequote (where,whereLen);
- continue;
- }
- if ( head[i+1] == 'w' &&
- head[i+2] == 'h' &&
- head[i+3] == 'e' &&
- head[i+4] == 'n' ) {
- // insert the location
- int32_t whenLen;
- char *when = r->getString("when",&whenLen);
- // skip over the %when
- i += 4;
- if ( ! when ) continue;
- sb.dequote (when,whenLen);
- continue;
- }
- // %sortby
- if ( head[i+1] == 's' &&
- head[i+2] == 'o' &&
- head[i+3] == 'r' &&
- head[i+4] == 't' &&
- head[i+5] == 'b' &&
- head[i+6] == 'y' ) {
- // insert the location
- int32_t sortBy = r->getLong("sortby",1);
- // print the radio buttons
- char *cs[5];
- cs[0]="";
- cs[1]="";
- cs[2]="";
- cs[3]="";
- cs[4]="";
- if ( sortBy >=1 && sortBy <=4 )
- cs[sortBy] = " checked";
- sb.safePrintf(
- "<input type=radio name=sortby value=1%s>date "
- "<input type=radio name=sortby value=2%s>distance "
- "<input type=radio name=sortby value=3%s>relevancy "
- "<input type=radio name=sortby value=4%s>popularity",
- cs[1],cs[2],cs[3],cs[4]);
- // skip over the %sortby
- i += 6;
- continue;
- }
- if ( head[i+1] == 'e' ) {
- // now we got the %e, insert the query
- char *p = (char*) sb.getBuf();
- int32_t plen = sb.getAvail();
- int32_t eqlen = urlEncode ( p , plen , q , qlen );
- //p += eqlen;
- sb.incrementLength(eqlen);
- // skip over %e
- i += 1;
- continue;
- }
- if ( head[i+1] == 'N' ) {
- // now we got the %N, insert the global doc count
- //int64_t c=g_checksumdb.getRdb()->getNumGlobalRecs();
- //now each host tells us how many docs it has in itsping
- int64_t c = g_hostdb.getNumGlobalRecs();
- c += g_conf.m_docCountAdjustment;
- // never allow to go negative
- if ( c < 0 ) c = 0;
- //p+=ulltoa(p,c);
- char *p = (char*) sb.getBuf();
- sb.reserve2x(16);
- int32_t len = ulltoa(p, c);
- sb.incrementLength(len);
- // skip over %N
- i += 1;
- continue;
- }
- /*
- if ( head[i+1] == 'E' ) {
- // now each host tells us how many docs it has in its
- // ping request
- int64_t c = g_hostdb.getNumGlobalEvents();
- char *p = (char*) sb.getBuf();
- sb.reserve2x(16);
- int32_t len = ulltoa(p, c);
- sb.incrementLength(len);
- // skip over %E
- i += 1;
- continue;
- }
- */
- if ( head[i+1] == 'n' ) {
- // now we got the %n, insert the collection doc count
- //p+=ulltoa(p,docsInColl);
- char *p = (char*) sb.getBuf();
- sb.reserve2x(16);
- int64_t docsInColl = 0;
- if ( cr ) docsInColl = cr->getNumDocsIndexed();
- int32_t len = ulltoa(p, docsInColl);
- sb.incrementLength(len);
- // skip over %n
- i += 1;
- continue;
- }
- /*
- if ( head[i+1] == 'T' ) {
- // . print the final tail
- // . only print admin link if we're local
- //int32_t user = g_pages.getUserType ( s , r );
- //char *username = g_users.getUsername(r);
- //char *pwd = r->getString ( "pwd" );
- char *p = (char*) sb.getBuf();
- int32_t plen = sb.getAvail();
- //p = g_pages.printTail ( p , p + plen , user , pwd );
- char *n = g_pages.printTail(p , p + plen ,
- r->isLocal());
- sb.incrementLength(n - p);
- // skip over %T
- i += 1;
- continue;
- }
- */
- // print the drop down menu for selecting the # of reslts
- if ( head[i+1] == 'D' ) {
- // skip over %D
- i += 1;
- // skip if not enough buffer
- //if ( p + 1000 >= pend ) continue;
- // # results
- //int32_t n = r->getLong("n",10);
- //bool printedDropDown;
- //p = printNumResultsDropDown(p,n,&printedDropDown);
- //printNumResultsDropDown(sb,n,&printedDropDown);
- continue;
- }
- if ( head[i+1] == 'H' ) {
- // . insert the secret key here, to stop seo bots
- // . TODO: randomize its position to make parsing more
- // difficult
- // . this secret key is for submitting a new query
- // int32_t key;
- // char kname[4];
- // g_httpServer.getKey (&key,kname,NULL,0,time(NULL),0,
- // 10);
- //sprintf (p , "<input type=hidden name=%s value=%"INT32">",
- // kname,key);
- //p += gbstrlen ( p );
- // sb.safePrintf( "<input type=hidden name=%s "
- //"value=%"INT32">",
- // kname,key);
- //adds param for default screen size
- //if(cr)
- // sb.safePrintf("<input type=hidden "
- //"id='screenWidth' name='ws' value=%"INT32">",
- //cr->m_screenWidth);
- // insert collection name too
- int32_t collLen;
- char *coll = r->getString ( "c" , &collLen );
- if ( collLen > 0 && collLen < MAX_COLL_LEN ) {
- //sprintf (p,"<input type=hidden name=c "
- // "value=\"");
- //p += gbstrlen ( p );
- sb.safePrintf("<input type=hidden name=c "
- "value=\"");
- //gbmemcpy ( p , coll , collLen );
- //p += collLen;
- sb.safeMemcpy(coll, collLen);
- //sprintf ( p , "\">\n");
- //p += gbstrlen ( p );
- sb.safePrintf("\">\n");
- }
- // pass this crap on so zak can do searches
- //char *username = g_users.getUsername(r);
- // this is null because not in the cookie and we are
- // logged in
- //char *pwd = r->getString ( "pwd" );
- //sb.safePrintf("<input type=hidden name=pwd "
- //"value=\"%s\">\n",
- //pwd);
- //sb.safePrintf("<input type=hidden name=username "
- // "value=\"%s\">\n",username);
- // skip over %H
- i += 1;
- continue;
- }
- // %t, print Top Directory section
- if ( head[i+1] == 't' ) {
- i += 1;
- //p = printTopDirectory ( p, pend );
- printTopDirectory ( sb , FORMAT_HTML );
- continue;
- }
- // MDW
- if ( head[i+1] == 'F' ) {
- i += 1;
- //p = printTopDirectory ( p, pend );
- if ( ! method ) method = "GET";
- sb.safePrintf("<form method=%s action=\"/search\" "
- "name=\"f\">\n",method);
- continue;
- }
- if ( head[i+1] == 'L' ) {
- i += 1;
- //p = printTopDirectory ( p, pend );
- printLogo ( sb , si );
- continue;
- }
- if ( head[i+1] == 'f' ) {
- i += 1;
- //p = printTopDirectory ( p, pend );
- printFamilyFilter ( sb , si->m_familyFilter );
- continue;
- }
- if ( head[i+1] == 'R' ) {
- i += 1;
- //p = printTopDirectory ( p, pend );
- printRadioButtons ( sb , si );
- continue;
- }
- // MDW
- // *p++ = head[i];
- sb.safeMemcpy((char*)&head[i], 1);
- continue;
- }
- //return p;
- return true;
- }
- bool printLeftColumnRocketAndTabs ( SafeBuf *sb ,
- bool isSearchResultsPage ,
- CollectionRec *cr ,
- char *tabName ) {
- class MenuItem {
- public:
- char *m_text;
- char *m_url;
- };
- static MenuItem mi[] = {
- {"SEARCH","/"},
- // {"DISCUSSIONS","/?searchtype=discussions"},
- // {"PRODUCTS","/?searchtype=products"},
- // {"ARTICLES","/?searchtype=articles"},
- // {"IMAGES","/?searchtype=images"},
- {"DIRECTORY","/Top"},
- {"ADVANCED","/adv.html"},
- {"ADD URL","/addurl"},
- {"WIDGETS","/widgets.html"},
- {"SYNTAX","/syntax.html"},
- {"USERS","/users.html"},
- {"ABOUT","/about.html"},
- {"BLOG","/blog.html"},
- // take this out for now
- //{"FEED","/searchfeed.html"},
- {"FAQ","/faq.html"},
- {"API","/api.html"}
- };
- char *coll = "";
- if ( cr ) coll = cr->m_coll;
- //
- // first the nav column
- //
- sb->safePrintf(
- "<TD bgcolor=#%s " // f3c714 " // yellow/gold
- "valign=top "
- "style=\"width:210px;"
- "border-right:3px solid blue;"
- "\">"
- "<br>"
- "<center>"
- "<a href=/?c=%s>"
- "<div style=\""
- "background-color:white;"
- "padding:10px;"
- "border-radius:100px;"
- "border-color:blue;"
- "border-width:3px;"
- "border-style:solid;"
- "width:100px;"
- "height:100px;"
- "\">"
- , GOLD
- , coll
- );
- if ( strcmp(tabName,"appliance") == 0 )
- sb->safePrintf("<img style=margin-top:21px; width=90 "
- "height=57 src=/computer2.png>");
- else
- sb->safePrintf("<br style=line-height:10px;>"
- "<img border=0 "
- "width=54 height=79 src=/rocket.jpg>"
- );
- sb->safePrintf ( "</div>"
- "</a>"
- "</center>"
- "<br>"
- "<br>"
- );
- int32_t n = sizeof(mi) / sizeof(MenuItem);
- for ( int32_t i = 0 ; i < n ; i++ ) {
- // just show search, directory and advanced tab in serps
- if ( isSearchResultsPage && i >= 3 ) break;
- // what was this for?
- // if ( i >= 1 && i <= 4 &&
- // cr->m_diffbotApiUrl.length() >= 0 )
- // continue;
- char delim = '?';
- if ( strstr ( mi[i].m_url,"?") ) delim = '&';
- sb->safePrintf(
- "<a href=%s%cc=%s>"
- "<div style=\""
- "padding:5px;"
- "position:relative;"
- "text-align:right;"
- "border-width:3px;"
- "border-right-width:0px;"
- "border-style:solid;"
- "margin-left:10px;"
- "border-top-left-radius:10px;"
- "border-bottom-left-radius:10px;"
- "font-size:14px;"
- "x-overflow:;"
- , mi[i].m_url
- , delim
- , coll
- );
- //if ( i == pageNum )
- bool matched = false;
- if ( strcasecmp(mi[i].m_text,tabName) == 0 )
- matched = true;
- if ( matched )
- sb->safePrintf(
- "border-color:blue;"
- "color:black;"
- "background-color:white;\" ");
- else
- sb->safePrintf("border-color:white;"
- "color:white;"
- "background-color:blue;\" "
- " onmouseover=\""
- "this.style.backgroundColor='lightblue';"
- "this.style.color='black';\""
- " onmouseout=\""
- "this.style.backgroundColor='blue';"
- "this.style.color='white';\""
- );
- sb->safePrintf(">"
- // make button wider
- "<nobr>"
- " "
- "<b>%s</b> </nobr>"
- , mi[i].m_text
- );
- //
- // begin hack: white out the blue border line!!
- //
- if ( matched )
- sb->safePrintf(
- "<div style=padding:5px;top:0;"
- "background-color:white;"
- "display:inline-block;"
- "position:absolute;>"
- " "
- "</div>"
- );
- // end hack
- sb->safePrintf(
- "</div>"
- "</a>"
- "<br>"
- );
- }
- // admin link
- if ( isSearchResultsPage ) return true;
- sb->safePrintf(
- "<a href=/admin/settings?c=%s>"
- "<div style=\"background-color:green;"
- // for try it out bubble:
- //"position:relative;"
- "padding:5px;"
- "text-align:right;"
- "border-width:3px;"
- "border-right-width:0px;"
- "border-style:solid;"
- "margin-left:10px;"
- "border-color:white;"
- "border-top-left-radius:10px;"
- "border-bottom-left-radius:10px;"
- "font-size:14px;"
- "color:white;"
- "cursor:hand;"
- "cursor:pointer;\" "
- " onmouseover=\""
- "this.style.backgroundColor='lightgreen';"
- "this.style.color='black';\""
- " onmouseout=\""
- "this.style.backgroundColor='green';"
- "this.style.color='white';\""
- ">"
- /*
- // try it out bubble div
- "<div "
- " onmouseover=\""
- "this.style.box-shadow='10px 10px 5px #888888';"
- "\""
- " onmouseout=\""
- "this.style.box-shadow='';"
- "\""
- "style=\""
- "vertical-align:middle;"
- "text-align:left;"
- "cursor:pointer;"
- "cursor:hand;"
- //"border-color:black;"
- //"border-style:solid;"
- //"border-width:2px;"
- "padding:3px;"
- //"width:30px;"
- //"height:20px;"
- //"margin-top:-20px;"
- "margin-left:-120px;"
- "position:absolute;"
- //"top:-20px;"
- //"left:10px;"
- "display:inline-block;"
- "\""
- ">"
- "<b style=font-size:11px;>"
- "Click for demo"
- "</b>"
- "</div>"
- */
- // end try it out bubble div
- "<b>ADMIN</b> "
- "</div>"
- "</a>"
- "<br>"
- "</TD>"
- , coll
- );
- return true;
- }
- bool printFrontPageShell ( SafeBuf *sb , char *tabName , CollectionRec *cr ,
- bool printGigablast ) {
- sb->safePrintf("<html>\n");
- sb->safePrintf("<head>\n");
- //sb->safePrintf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf8\">");
- sb->safePrintf("<meta name=\"description\" content=\"A powerful, new search engine that does real-time indexing!\">\n");
- sb->safePrintf("<meta name=\"keywords\" content=\"search, search engine, search engines, search the web, fresh index, green search engine, green search, clean search engine, clean search\">\n");
- //char *title = "An Alternative Open Source Search Engine";
- char *title = "An Alternative Open Source Search Engine";
- if ( strcasecmp(tabName,"search") ) title = tabName;
- // if ( pageNum == 1 ) title = "Directory";
- // if ( pageNum == 2 ) title = "Advanced";
- // if ( pageNum == 3 ) title = "Add Url";
- // if ( pageNum == 4 ) title = "About";
- // if ( pageNum == 5 ) title = "Help";
- // if ( pageNum == 6 ) title = "API";
- sb->safePrintf("<title>Gigablast - %s</title>\n",title);
- sb->safePrintf("<style><!--\n");
- sb->safePrintf("body {\n");
- sb->safePrintf("font-family:Arial, Helvetica, sans-serif;\n");
- sb->safePrintf("color: #000000;\n");
- sb->safePrintf("font-size: 12px;\n");
- sb->safePrintf("margin: 0px 0px;\n");
- sb->safePrintf("letter-spacing: 0.04em;\n");
- sb->safePrintf("}\n");
- sb->safePrintf("a {text-decoration:none;}\n");
- //sb->safePrintf("a:link {color:#00c}\n");
- //sb->safePrintf("a:visited {color:#551a8b}\n");
- //sb->safePrintf("a:active {color:#f00}\n");
- sb->safePrintf(".bold {font-weight: bold;}\n");
- sb->safePrintf(".bluetable {background:#d1e1ff;margin-bottom:15px;font-size:12px;}\n");
- sb->safePrintf(".url {color:#008000;}\n");
- sb->safePrintf(".cached, .cached a {font-size: 10px;color: #666666;\n");
- sb->safePrintf("}\n");
- sb->safePrintf("table {\n");
- sb->safePrintf("font-family:Arial, Helvetica, sans-serif;\n");
- sb->safePrintf("color: #000000;\n");
- sb->safePrintf("font-size: 12px;\n");
- sb->safePrintf("}\n");
- sb->safePrintf(".directory {font-size: 16px;}\n"
- ".nav {font-size:20px;align:right;}\n"
- );
- sb->safePrintf("-->\n");
- sb->safePrintf("</style>\n");
- sb->safePrintf("\n");
- sb->safePrintf("</head>\n");
- sb->safePrintf("<script>\n");
- sb->safePrintf("<!--\n");
- sb->safePrintf("function x(){document.f.q.focus();}\n");
- sb->safePrintf("// --></script>\n");
- sb->safePrintf("<body onload=\"x()\">\n");
- //sb->safePrintf("<body>\n");
- //g_proxy.insertLoginBarDirective ( &sb );
- //
- // DIVIDE INTO TWO PANES, LEFT COLUMN and MAIN COLUMN
- //
- sb->safePrintf("<TABLE border=0 height=100%% cellspacing=0 "
- "cellpadding=0>"
- "\n<TR>\n");
- // . also prints <TD>...</TD>
- // . false = isSearchResultsPage?
- printLeftColumnRocketAndTabs ( sb , false , cr , tabName );
- //
- // now the MAIN column
- //
- sb->safePrintf("\n<TD valign=top style=padding-left:30px;>\n");
- sb->safePrintf("<br><br>");
- if ( ! printGigablast )
- return true;
- sb->safePrintf("<a href=/><img border=0 width=470 "
- "height=44 src=/gigablast.jpg></a>\n");
- // sb->safePrintf("<br>"
- // "<img border=0 width=470 "
- // "height=15 src=/bar.jpg>\n");
- return true;
- }
- bool printWebHomePage ( SafeBuf &sb , HttpRequest *r , TcpSocket *sock ) {
- SearchInput si;
- si.set ( sock , r );
- // if there's a ton of sites use the post method otherwise
- // they won't fit into the http request, the browser will reject
- // sending such a large request with "GET"
- char *method = "GET";
- if ( si.m_sites && gbstrlen(si.m_sites)>800 ) method = "POST";
- // if the provided their own
- CollectionRec *cr = g_collectiondb.getRec ( r );
- if ( cr && cr->m_htmlRoot.length() ) {
- return expandHtml ( sb ,
- cr->m_htmlRoot.getBufStart(),
- cr->m_htmlRoot.length(),
- NULL,
- 0,
- r ,
- &si,
- //TcpSocket *s ,
- method , // "GET" or "POST"
- cr );//CollectionRec *cr ) {
- }
- // . search special types
- // . defaults to web which is "search"
- // . can be like "images" "products" "articles"
- char *searchType = r->getString("searchtype",NULL,"search",NULL);
- log("searchtype=%s",searchType);
- // pass searchType in as tabName
- printFrontPageShell ( &sb , searchType , cr , true );
- //sb.safePrintf("<br><br>\n");
- // try to avoid using https for images. it is like 10ms slower.
- // if ( g_conf.m_isMattWells )
- // sb.safePrintf("<center><a href=/><img border=0 width=500 "
- // "height=122 src=http://www.gigablast.com/logo-"
- // "med.jpg></a>\n");
- // else
- sb.safePrintf("<br><br>\n");
- sb.safePrintf("<br><br><br>\n");
- /*
- sb.safePrintf("<b>web</b> ");
- if ( g_conf.m_isMattWells )
- sb.safePrintf("<a href=http://www.gigablast.com/seo>seo</a> "
- " "
- );
- sb.safePrintf( "<a href=\"/Top\">directory</a> "
- " \n");
- sb.safePrintf("<a href=/adv.html>advanced search</a>");
- sb.safePrintf(" ");
- sb.safePrintf("<a href=/addurl title=\"Instantly add your url to "
- "Gigablast's index\">add url</a>");
- sb.safePrintf("\n");
- sb.safePrintf("<br><br>\n");
- */
- // submit to https now
- sb.safePrintf("<form method=%s "
- "action=/search name=f>\n", method);
- if ( cr )
- sb.safePrintf("<input type=hidden name=c value=\"%s\">",
- cr->m_coll);
- // put search box in a box
- sb.safePrintf("<div style="
- "background-color:#%s;"//fcc714;"
- "border-style:solid;"
- "border-width:3px;"
- "border-color:blue;"
- //"background-color:blue;"
- "padding:20px;"
- "border-radius:20px;"
- ">"
- ,GOLD
- );
- sb.safePrintf("<input name=q type=text "
- "style=\""
- //"width:%"INT32"px;"
- "height:26px;"
- "padding:0px;"
- "font-weight:bold;"
- "padding-left:5px;"
- //"border-radius:10px;"
- "margin:0px;"
- "border:1px inset lightgray;"
- "background-color:#ffffff;"
- "font-size:18px;"
- "\" "
- "size=40 value=\"\"> "
- //"<input type=\"submit\" value=\"Search\">"
- "<div onclick=document.f.submit(); "
- " onmouseover=\""
- "this.style.backgroundColor='lightgreen';"
- "this.style.color='black';\""
- " onmouseout=\""
- "this.style.backgroundColor='green';"
- "this.style.color='white';\" "
- "style=border-radius:28px;"
- "cursor:pointer;"
- "cursor:hand;"
- "border-color:white;"
- "border-style:solid;"
- "border-width:3px;"
- "padding:12px;"
- "width:20px;"
- "height:20px;"
- "display:inline-block;"
- "background-color:green;color:white;>"
- "<b style=margin-left:-5px;font-size:18px;"
- ">GO</b>"
- "</div>"
- "\n"
- );
- sb.safePrintf("</div>\n");
- sb.safePrintf("\n");
- sb.safePrintf("</form>\n");
- sb.safePrintf("<br>\n");
- sb.safePrintf("\n");
- if ( cr && cr->m_coll ) { // && strcmp(cr->m_coll,"main") ) {
- sb.safePrintf("<center>"
- "Searching the <b>%s</b> collection."
- "</center>",
- cr->m_coll);
- sb.safePrintf("<br>\n");
- sb.safePrintf("\n");
- }
- // take this out for now
- /*
- // always the option to add event guru to their list of
- // search engine in their browser
- sb.safePrintf("<br>"
- //"<br>"
- "<script>\n"
- "function addEngine() {\n"
- "if (window.external && "
- "('AddSearchProvider' in window.external)) {\n"
- // Firefox 2 and IE 7, OpenSearch
- "window.external.AddSearchProvider('http://"
- "www.gigablast.com/searchbar.xml');\n"
- "}\n"
- "else if (window.sidebar && ('addSearchEngine' "
- "in window.sidebar)) {\n"
- // Firefox <= 1.5, Sherlock
- "window.sidebar.addSearchEngine('http://"
- "www.gigablast.com/searchbar.xml',"
- //"example.com/search-plugin.src',"
- "'http://www.gigablast.com/rocket.jpg'," //guru.png
- "'Search Plugin', '');\n"
- "}\n"
- "else {"
- // No search engine support (IE 6, Opera, etc).
- "alert('No search engine support');\n"
- "}\n"
- // do not ask again if they tried to add it
- // meta cookie should store this
- //"document.getElementById('addedse').value='1';\n"
- // NEVER ask again! permanent cookie
- "document.cookie = 'didse=3';"
- // make it invisible again
- //"var e = document.getElementById('addse');\n"
- //"e.style.display = 'none';\n"
- "}\n"
- "</script>\n"
- "<center>"
- "<a onclick='addEngine();' style="
- "cursor:pointer;"
- "cursor:hand;"
- "color:blue;"
- ">"
- "<img height=16 width=16 border=0 src=/rocket16.png>"
- "<font color=#505050>"
- "%c%c%c "
- "</font>"
- " "
- "Add Gigablast to your browser's "
- "search engines"
- "</a>"
- "</center>"
- "<br>"
- "<br>"
- // print triangle
- ,0xe2
- ,0x96
- ,0xbc
- );
- */
- // print any red boxes we might need to
- if ( printRedBox2 ( &sb , sock , r ) ) // true ) )
- sb.safePrintf("<br>\n");
- sb.safePrintf("<br><center><table cellpadding=3>\n");
- sb.safePrintf("\n");
- char *root = "";
- if ( g_conf.m_isMattWells )
- root = "http://www.gigablast.com";
- sb.safePrintf("<tr valign=top>\n");
- //sb.safePrintf("<td align=center><div style=width:50px;height:50px;display:inline-block;background-color:red;></div></td>\n");
- sb.safePrintf("<td width=10%% "
- "align=center><img style=padding-right:10px; "
- "height=71px width=50px "
- "src=%s/opensource.png></td>\n"
- , root );
- sb.safePrintf("<td width=45%%><font size=+1><b>Open Source!</b>"
- "</font><br><br>\n");
- sb.brify2("Gigablast is now available as an <a href=https://github.com/gigablast/open-source-search-engine>open source search engine</a> on github.com. Download it today. Finally a robust, scalable search solution in C/C++ that has been in development and used commercially since 2000. <a href=http://www.gigablast.com/faq.html#features>Features</a>."
- ,40);
- //sb.safePrintf("<br><br>");
- sb.safePrintf("</td>");
- sb.safePrintf("<td><font size=+1><b>ScreenShots</b>"
- "</font><br><br>\n");
- sb.safePrintf("<a href=/ss_settings.png><img width=150 height=81 src=ss_settings_thumb.png></a>");
- sb.safePrintf("<br><br>");
- sb.safePrintf("<a href=/ss_hosts.png><img width=150 height=81 src=ss_hosts_thumb.png></a>");
- sb.safePrintf("<br><br>");
- sb.safePrintf("<a href=/ss_filters.png><img width=150 height=81 src=ss_filters_thumb.png></a>");
- sb.safePrintf("</td>");
- sb.safePrintf("</tr>\n");
- sb.safePrintf("</table></center>\n");
- /*
- do not show table for open source installs
- // donate with paypal
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td align=center style=padding-right:20px;><center>"
- // BEGIN PAYPAL DONATE BUTTON
- "<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" target=\"_top\">"
- "<input type=\"hidden\" name=\"cmd\" value=\"_donations\">"
- "<input type=\"hidden\" name=\"business\" value=\"2SFSFLUY3KS9Y\">"
- "<input type=\"hidden\" name=\"lc\" value=\"US\">"
- "<input type=\"hidden\" name=\"item_name\" value=\"Gigablast, Inc.\">"
- "<input type=\"hidden\" name=\"currency_code\" value=\"USD\">"
- "<input type=\"hidden\" name=\"bn\" value=\"PP-DonationsBF:btn_donateCC_LG.gif:NonHosted\">"
- "<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\" height=47 width=147>"
- "<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">"
- "</form>"
- // END PAYPAY BUTTON
- "</center></div></center></td>\n"
- );
- sb.safePrintf("<td><font size=+1><b>"
- "Support Gigablast"
- "</b></font><br>\n"
- );
- sb.brify2(
- "Donations of $100 or more receive a black "
- "Gigablast T-shirt "
- "with embroidered logo while quantities last. "
- "State your address and size "
- "in an <a href=/contact.html>email</a>. "
- "PayPal accepted. "
- "Help Gigablast continue "
- "to grow and add new features."
- , 80
- );
- sb.safePrintf("</td></tr>\n");
- */
- /*
- sb.safePrintf("<tr valign=top>\n");
- // 204x143
- sb.safePrintf("<td><img height=52px width=75px "
- "src=%s/eventguru.png></td>\n"
- , root );
- sb.safePrintf("<td><font size=+1><b>Event Guru Returns</b></font><br>\n");
- sb.brify2("<a href=http://www.eventguru.com/>Event Guru</a> datamines events from the web. It identifies events on a web page, or even plain text, using the same rules of deduction used by the human mind. It also has Facebook integration and lots of other cool things.",80);
- sb.safePrintf("<br><br></td></tr>\n");
- sb.safePrintf("\n");
- sb.safePrintf("\n");
- */
- /*
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td align=center><div style=width:50px;height:50px;display:inline-block;background-color:green;></div></td>\n");
- sb.safePrintf("<td><font size=+1><b>The Green Search Engine</b></font><br>\n");
- sb.brify2("Gigablast is the only clean-powered web search engine. 90% of its power usage comes from wind energy. Astoundingly, Gigablast is one of ONLY four search engines in the United States indexing over a billion pages.",80);
- sb.safePrintf("<br><br></td></tr>\n");
- sb.safePrintf("\n");
- sb.safePrintf("\n");
- */
- /*
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td align=center><img src=%s/gears.png "
- "height=50 width=50></div></td>\n"
- , root );
- sb.safePrintf("<td><font size=+1><b>The Transparent Search Engine</b></font><br>\n");
- sb.brify2("Gigablast is the first truly transparent search engine. It tells you exactly why the search results are ranked the way they are. There is nothing left to the imagination.",85);
- sb.safePrintf("<br><br>");
- sb.safePrintf("</td></tr>\n");
- sb.safePrintf("\n");
- sb.safePrintf("\n");
- */
- /*
- if ( g_conf.m_isMattWells ) {
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td align=center><center><img src=%s/dollargear.png "
- "height=50 width=50></center></div></center></td>\n"
- , root );
- sb.safePrintf("<td><font size=+1><b>The SEO Search Engine</b></font><br>\n");
- sb.brify2("When it comes to search-engine based SEO, Gigablast is the place to be. With a frothy set of unique and effective <a href=http://www.gigablast.com/seo>SEO tools</a>, you will find all you need to execute a simple yet effective SEO strategy. Stop the guesswork, and let a search engine tell you how to SEO it.",85);
- sb.safePrintf("</td></tr>\n");
- }
- */
- /*
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td><div style=width:50px;height:50px;display:inline-block;background-color:ff3030;></td>\n");
- sb.safePrintf("<td><font size=+1><b>Xml Search Feed</b></font><br>\n");
- sb.brify2("Utilize Gigablast's results on your own site or product by connecting with Gigablast's <a href=/searchfeed.html>XML search feed</a>. It's now simpler than ever to setup and use. You can also add the web pages you want into the index in near real-time.",85);
- sb.safePrintf("</td></tr>\n");
- */
- /*
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td><div style=width:50px;height:50px;display:inline-block;background-color:black;></td>\n");
- sb.safePrintf("<td><font size=+1><b>The Private Search Engine</b>"
- "</font><br>\n");
- sb.brify2("Gigablast does not allow the NSA or any third party "
- "to spy on the queries your IP address is doing, "
- "unlike "
- "<a href=http://www.guardian.co.uk/world/2013/jun/"
- "06/us-tech-giants-nsa-data>"
- "other large search engines</a>. "
- "Gigablast is the only "
- "<a href=/privacy.html>truly private search engine</a> "
- "in the United States."
- //" Everyone else has fundamental "
- //"gaps in their "
- //"security as explained by the above link."
- //"Tell Congress "
- //"to <a href=https://optin.stopwatching.us/>stop spying "
- //"on you</a>."
- ,85);
- sb.safePrintf("</td></tr>\n");
- */
- /*
- sb.safePrintf("<tr valign=top>\n");
- sb.safePrintf("<td><div style=width:50px;height:50px;display:inline-block;background-color:black;></td>\n");
- sb.safePrintf("<td><font size=+1><b>No Tax Dodging</b></font><br>\n");
- sb.brify2("Gigablast pays its taxes when it makes a profit. "
- "Google and Bing <a href=http://www.bloomberg.com/news/"
- "2010-10-21/google-2-4-rate-shows-how-60-billion-u-s-"
- "revenue-lost-to-tax-loopholes.html>do not</a>. They "
- "stash their profits in "
- "offshore tax havens to avoid paying taxes. "
- //"The end result is that taxes are higher for you. "
- "You may think Google and Bing are free to use, but in "
- "reality, <u>you</u> pay for it in increased taxes."
- ,85);
- sb.safePrintf("</td></tr>\n");
- */
- //
- // begin new stuff
- //
- /*
- // gradients
- sb.safePrintf("<style><!--\n");
-
- sb.safePrintf(".grad {");
- sb.safePrintf("background: rgb(190,201,247);");
- sb.safePrintf("background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMTAwJSI+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjYmVjOWY3IiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzBiM2NlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);");
- sb.safePrintf("background: -moz-linear-gradient(-45deg, rgba(190,201,247,1) 0%%, rgba(11,60,237,1) 100%%);");
- sb.safePrintf("background: -webkit-gradient(linear, left top, right bottom, color-stop(0%%,rgba(190,201,247,1)), color-stop(100%%,rgba(11,60,237,1)));");
- sb.safePrintf("background: -webkit-linear-gradient(-45deg, rgba(190,201,247,1) 0%%,rgba(11,60,237,1) 100%%);");
- sb.safePrintf("background: -o-linear-gradient(-45deg, rgba(190,201,247,1) 0%%,rgba(11,60,237,1) 100%%);");
- sb.safePrintf("background: -ms-linear-gradient(-45deg, rgba(190,201,247,1) 0%%,rgba(11,60,237,1) 100%%);");
- sb.safePrintf("background: linear-gradient(135deg, rgba(190,201,247,1) 0%%,rgba(11,60,237,1) 100%%);");
- sb.safePrintf("filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bec9f7', endColorstr='#0b3ced',GradientType=1 );");
- sb.safePrintf("}");
- sb.safePrintf("-->");
- sb.safePrintf("</style>\n");
- sb.safePrintf("<br>");
- sb.safePrintf("<div class=grad style=\"border-radius:200px;border-color:blue;border-style:solid;border-width:3px;padding:12px;width:320px;height:320px;display:inline-block;z-index:100;color:black;position:relative;background-color:lightgray;\">");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>");
- sb.safePrintf("<font style=font-size:18px;margin-left:80px;>");
- sb.safePrintf("Build Your Own");
- sb.safePrintf("</font>");
- sb.safePrintf("<br>");
- sb.safePrintf("<font style=font-size:18px;margin-left:80px;>");
- sb.safePrintf("Search Engine in the");
- sb.safePrintf("</font>");
- sb.safePrintf("<br>");
- sb.safePrintf("<font style=font-size:18px;margin-left:80px;>");
- sb.safePrintf("Cloud");
- sb.safePrintf("</font>");
- sb.safePrintf("</b>");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("<div style=margin-left:20px;width:270px;>");
- sb.safePrintf("<a href=/admin/addcoll><img style=float:left;padding-right:15px; height=188px width=101px src=/robot3.png></a>");
- //sb.safePrintf("<br>");
- sb.safePrintf("<b>STEP 1.</b> <a href=/admin/addcoll?guide=1>"
- "Click here to");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>name your engine</b></a>.");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>STEP 2.</b> <a href=/admin/settings?guide=1>"
- "Click here to ");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>add websites to index</b></a>.");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>STEP 3.</b> <a href=/widgets.html?guide=1>"
- "Click here to");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>insert search box</b></a>.");
- sb.safePrintf("</div>");
- sb.safePrintf("</div>");
- */
- /*
- sb.safePrintf("<div class=grad style=\"border-radius:200px;border-color:blue;border-style:solid;border-width:3px;padding:12px;width:280px;height:280px;display:inline-block;z-index:105;color:black;margin-left:-50px;position:absolute;margin-top:50px;background-color:lightgray;\">");
- sb.safePrintf("<br>");
- sb.safePrintf("<br style=line-height:25px;>");
- sb.safePrintf("<b>");
- sb.safePrintf("<font style=font-size:18px;margin-left:40px;>");
- sb.safePrintf("Web Search Appliance");
- sb.safePrintf("</font>");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("</b>");
- sb.safePrintf("<div style=margin-left:20px;width:270px;>");
- sb.safePrintf("<a href=http://www.gigablast.com/appliance.html><img style=float:left;padding-bottom:20px;padding-right:10px; height=81px width=121px src=/computer2.png></a>");
- sb.safePrintf("Put the web in your closet. ");
- sb.safePrintf("Jump start your efforts with four 1U supermicro servers loaded with the top 2 billion pages from the web. <a href=http://www.gigablast.com/appliance.html>[learn more]</a>");
- sb.safePrintf("</font>");
- sb.safePrintf("</div>");
- sb.safePrintf("</div>");
- */
- /*
- sb.safePrintf("<div class=grad style=\"border-radius:300px;border-color:blue;border-style:solid;border-width:3px;padding:12px;width:240px;height:240px;display:inline-block;z-index:110;color:black;margin-left:-240px;position:absolute;margin-top:230px;background-color:lightgray;\">");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>");
- sb.safePrintf("<font style=font-size:18px;margin-left:60px;>");
- sb.safePrintf("Open Source");
- sb.safePrintf("</font>");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("</b>");
- sb.safePrintf("<div style=margin-left:30px;margin-right:5px;>");
- sb.safePrintf("<a href=http://www.gigablast.com/faq.html#features><img style=float:left;padding-right:10px height=71px width=71px src=/unlocked2.png></a>");
- sb.safePrintf("Gigablast is now available as an <a href=https://github.com/gigablast/open-source-search-engine>open source search engine</a> on github.com. Download it today. Finally a robust, scalable search solution in C/C++ that has been in development and used commercially since 2000. <a href=http://www.gigablast.com/faq.html#features>Features</a>.");
- sb.safePrintf("</div>");
- sb.safePrintf("</div>");
- //
- // donate with paypal bubble
- //
- sb.safePrintf("<div class=grad style=\"border-radius:300px;border-color:blue;border-style:solid;border-width:3px;padding:12px;width:180px;height:180px;display:inline-block;z-index:120;color:black;margin-left:10px;position:absolute;margin-top:270px;background-color:lightgray;\">");
- sb.safePrintf("<br>");
- sb.safePrintf("<b>");
- sb.safePrintf("<font style=font-size:18px;margin-left:40px;>");
- sb.safePrintf("Contribute");
- sb.safePrintf("</font>");
- sb.safePrintf("<br>");
- sb.safePrintf("<br>");
- sb.safePrintf("</b>");
- sb.safePrintf("<div style=margin-left:15px;margin-right:5px;>");
- sb.safePrintf(
- "Help Gigablast development with PayPal."
- "<br>"
- "<br>"
- // BEGIN PAYPAL DONATE BUTTON
- "<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" target=\"_top\">"
- "<input type=\"hidden\" name=\"cmd\" value=\"_donations\">"
- "<input type=\"hidden\" name=\"business\" value=\"2SFSFLUY3KS9Y\">"
- "<input type=\"hidden\" name=\"lc\" value=\"US\">"
- "<input type=\"hidden\" name=\"item_name\" value=\"Gigablast, Inc.\">"
- "<input type=\"hidden\" name=\"currency_code\" value=\"USD\">"
- "<input type=\"hidden\" name=\"bn\" value=\"PP-DonationsBF:btn_donateCC_LG.gif:NonHosted\">"
- "<input type=\"image\" src=\"https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\" height=47 width=147>"
- "<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">"
- "</form>"
- // END PAYPAY BUTTON
- "</center></div></center>"
- //"</td>\n"
- );
- */
- //
- // end new stuff
- //
- sb.safePrintf("\n");
- sb.safePrintf("\n");
- //sb.safePrintf("</table>\n");
- sb.safePrintf("<br><br>\n");
- printNav ( sb , r );
- return true;
- }
- bool printAddUrlHomePage ( SafeBuf &sb , char *url , HttpRequest *r ) {
- CollectionRec *cr = g_collectiondb.getRec ( r );
- printFrontPageShell ( &sb , "add url" , cr , true );
- sb.safePrintf("<script type=\"text/javascript\">\n"
- "function handler() {\n"
- "if(this.readyState == 4 ) {\n"
- "document.getElementById('msgbox').innerHTML="
- "this.responseText;\n"
- //"alert(this.status+this.statusText+"
- //"this.responseXML+this.responseText);\n"
- "}}\n"
- "</script>\n");
- sb.safePrintf("<br><br>\n");
- sb.safePrintf("<br><br><br>\n");
- /*
- sb.safePrintf("<b>web</b> ");
- if ( g_conf.m_isMattWells )
- sb.safePrintf("<a href=http://www.gigablast.com/seo>seo</a> "
- " "
- );
- sb.safePrintf( "<a href=\"/Top\">directory</a> "
- " \n");
- sb.safePrintf("<a href=/adv.html>advanced search</a>");
- sb.safePrintf(" ");
- sb.safePrintf("<a href=/addurl title=\"Instantly add your url to "
- "Gigablast's index\">add url</a>");
- sb.safePrintf("\n");
- sb.safePrintf("<br><br>\n");
- */
- // submit to https now
- sb.safePrintf("<form method=GET "
- "action=/addurl name=f>\n" );
- char *coll = "";
- if ( cr ) coll = cr->m_coll;
- if ( cr )
- sb.safePrintf("<input type=hidden name=c value=\"%s\">",
- cr->m_coll);
- // put search box in a box
- sb.safePrintf("<div style="
- "background-color:#%s;" // fcc714;"
- "border-style:solid;"
- "border-width:3px;"
- "border-color:blue;"
- //"background-color:blue;"
- "padding:20px;"
- "border-radius:20px;"
- ">"
- , GOLD
- );
- sb.safePrintf("<input name=urls type=text "
- "style=\""
- //"width:%"INT32"px;"
- "height:26px;"
- "padding:0px;"
- "…
Large files files are truncated, but you can click here to view the full file