void htmlZone(void) { htmlHeader("idnsAdmin","Header"); htmlZonePage("idnsAdmin","Admin.Zone.Body"); htmlFooter("Footer"); }//void htmlZone(void)
int main() { char **postvars = NULL; /* POST request data repository */ char **getvars = NULL; /* GET request data repository */ int form_method; /* POST = 1, GET = 0 */ form_method = getRequestMethod(); if(form_method == POST) { getvars = getGETvars(); postvars = getPOSTvars(); } else if(form_method == GET) { getvars = getGETvars(); } htmlHeader("Demo Web Page"); htmlBody(); template_page(postvars, form_method); htmlFooter(); cleanUp(form_method, getvars, postvars); fflush(stdout); exit(0); }
void htmlAlias(void) { htmlHeader("unxsMail System","Header"); htmlAliasPage("unxsMail System","Alias.Body"); htmlFooter("Footer"); }//void htmlAlias(void)
void htmlLogin(void) { htmlHeader("Radius System","Header"); htmlLoginPage("Radius System","Login.Body"); htmlFooter("Footer"); }//void htmlLogin(void)
void htmlCustomerContact(void) { htmlHeader("idnsAdmin","Header"); htmlCustomerContactPage("idnsAdmin","CustomerUser.Body"); htmlFooter("Footer"); }//void htmlCustomerContact(void)
void htmlSpamSettings(void) { htmlHeader("unxsMail User Interface","Header"); htmlSpamSettingsPage("unxsMail User Interface","SpamSettings.Body"); htmlFooter("Footer"); }//void htmlSpamSettings(void)
void htmlCustomerContactWizard(unsigned uStep) { htmlHeader("idnsAdmin","Header"); sprintf(gcQuery,"CustomerUserWizard.%u",uStep); htmlCustomerContactPage("idnsAdmin",gcQuery); htmlFooter("Footer"); }//void htmlCustomerContactWizard(unsigned uStep)
void htmlCustomer(void) { if(!gcFunction[0] || !strcmp(gcFunction,"Login") || !strcmp(gcFunction,"Finish")) LoadCustomer(guLoginClient); htmlHeader("unxsISP Customer Interface","Header"); htmlCustomerPage("","MyAccount.Body"); htmlFooter("Footer"); }//void htmlCustomer(void)
int main () { int returncode = 0; int i; char *nid; int numQueryString; Envar *query; cLogInitDB(); htmlHeader("News Item"); returncode = cLogGetUsername(principalName); if(cLogGetUsername(principalName) >= 20) printf("<p>Database name lookup failure"); if(cLogGetGroups(principalName, principalGroups) >= 20) printf("<p>Database group lookup failure"); query = parseEnVar(getenv("QUERY_STRING"), &numQueryString); if(numQueryString == 0) { printf("<P>Critical Error: Invalid News Request"); htmlStaticPrint("footer"); exit(EXIT_FAILURE); } for (i = 0; i < numQueryString; i++) { if(strcmp(query[i].key,"nid") == 0) nid = strdup(query[i].val); } for (i = 0; i < numQueryString; i++) { free(query[i].key); free(query[i].val); } htmlLeftSide(principalName, principalGroups); htmlStaticPrint("contenttablestart"); shownews(principalName, principalGroups, nid); printf("<p>I'm working on this. Eventually you will be able to edit and delete (if no one has posted a comment) your news submissions -Mark</p>"); htmlStaticPrint("contenttableend"); free(nid); htmlStaticPrint("footer"); return 0; }
//////////////////////////////////////////////////////////////////////////// // Function: reset //////////////////////////////////////////////////////////////////////////// int reset(char **postvars, int form_method) { //unsigned long ulTemp; //int iTemp, i, size; //char pcTmp[24]; //unsigned char ucbuf[sizeof(smtp_conf)]; int i, flag; htmlHeader("reset << Xumo Security AB"); //usleep(1000); Getlanguage_type(); ////language initializtion ///////////////////////////// get_web_language("language.txt","#reset.cgi"); cyber_language_type=CONF_LANGUAGE->language_type; // If we got post, write it into flash if(form_method == POST) { printf("<body><center class=\"statusIndicate\"><BR><BR><br><br><br><br>"); for (i=0; postvars[i]; i+= 2) { #if DEBUG printf("DEBUG: [%s] = [%s]<br>", postvars[i], postvars[i+1]); #endif // Parse for Select if(!strcmp(postvars[i],"Type")) { flag = atoi(postvars[i+1]); } } // end of parse loop #if DEBUG // Debug the value in struct printf("Write result:<br>\n"); #endif // execute reset if(flag == 1) { if(system("nohup cp -f /ffmpeg/config /mnt/mtd > /dev/null") < 0) { perror("reset config"); } if(system("nohup cp -f /ffmpeg/.htpasswd /mnt/mtd > /dev/null") < 0) { perror("reset passwd"); } if(system("nohup cp -f /ffmpeg/.htpasswd /web/html > /dev/null") < 0) { perror("reset passwd"); } } else { printf("Nothing changed!\n"); } printf("Configuration succeeded<br><br>"); printf("</center></body></html>"); printf("<meta http-equiv=\"refresh\" content=\"1;url=reset.cgi\">"); return 0; } // end of "if we got post" //////////////////////////////////////////// // Start CGI, Get configuration value here //////////////////////////////////////////// printf(" <body> \n"); printf(" <div id=\"page\"> \n"); printf(" <div id=\"container\" class=\"clearfix\"> \n"); printf(" <div id=\"content\" style=\"min-height: 200px; height:200px;\"> \n"); printf(" <div id=\"mainblock\" > \n"); printf(" <h1> System Information</h1> \n"); printf("<div id=\"video\"><a href=\"javascript:top.location.href='../index.html';\"><img src=\"../includes/icon-video.jpg\" alt=\"Icon - video\" /></a></div> \n"); printf(" <div class=\"entry\"> \n"); printf(" <form class=\"mainform\" name=ftpset action=\"/cgi-bin/reset.cgi\" method=POST> \n"); printf(" <table> \n"); printf(" <tr class=\"bg_header\"> \n"); get_web_context("Reset Configurations",web_sentence,cyber_language_type); printf(" <td>%s</td> \n", web_sentence); printf(" </tr> \n"); printf(" <tr class=\"bg_subheader\"> \n"); printf(" <td>Reset</td> \n"); printf(" </tr> \n"); printf(" <tr> \n"); printf(" <td> \n"); get_web_context("Select Configurations",web_sentence,cyber_language_type); printf(" <label>%s</label> \n", web_sentence); printf(" <select name=Type> \n"); printf(" <option value=1 selected>ALL</option> \n"); printf(" <option value=2>NONE</option> \n"); printf(" </select> \n"); printf(" </td> \n"); printf(" </tr> \n"); printf(" <tr> \n"); printf(" <td><hr /></td> \n"); printf(" </tr> \n"); printf(" <tr> \n"); get_web_context("Apply",web_sentence,cyber_language_type); printf(" <td><input type=\"submit\" class=\"submit\" value=\"%s\" /></td> \n", web_sentence); printf(" </tr> \n"); printf(" </table> \n"); printf(" </form> \n"); printf(" </div> \n"); printf(" </div> \n"); printf(" </div> \n"); printf(" </div> \n"); printf(" </div> \n"); printf(" <script type=\"text/javascript\">Cufon.now();</script> \n"); printf(" </body> \n"); printf(" </html> \n"); fflush(stdout); //////////////////// old cgi ///////////////////// /* printf(" <html><head>\n"); printf(" <style type=\"text/css\">\n"); printf("<!--\n"); printf(".STYLE1 { font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px;}\n"); printf(".STYLE4 { font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n"); printf("-->\n"); printf("</style>\n"); printf("</head>\n"); printf("<center><BR>\n"); printf("<FORM name=ftpset ACTION=\"/cgi-bin/reset.cgi\" METHOD=POST>\n"); printf("<table border=0 cellpadding=\"0\" cellspacing=\"0\" width=\"80%\">\n"); *web_sentence='\0'; get_web_context("Reset Configurations",web_sentence,cyber_language_type); printf(" <tr><td width=\"527\" height=\"30\" bgcolor=\"#999999\"><div align=\"center\" class=\"STYLE1\">%s</div></td></tr>\n",web_sentence); printf(" <tr><td height=\"20\" bgcolor=\"#CCCCCC\"> <span class=\"STYLE4\">Reset</span></td></tr>\n"); printf("<tr><td><table border=0>\n"); printf("<tr><td><td>\n"); */ // Check User /* GetConfValues(); if(GetRights()>0) { printf(" <script language=JavaScript>\n"); printf(" <!-- \n"); printf(" top.location.href=\"../index.html\";\n"); printf(" //--> \n"); printf(" </script> \n"); }*/ // Reset Select /* *web_sentence='\0'; get_web_context("Select Configurations",web_sentence,cyber_language_type); printf("<tr><td><span class=\"STYLE4\">%s<td>\n",web_sentence); printf("<select name=Type>\n"); printf("<option value=1 selected> ALL \n"); printf("<option value=2> NONE \n"); printf("</table><tr><td><hr></td></tr>\n"); *web_sentence='\0'; get_web_context("Apply",web_sentence,cyber_language_type); printf("<tr><td><input type=submit class=button value=%s></td></tr>\n",web_sentence); printf("</form></font></center></html>\n"); */ free(CONF_SYS); return 0; }
int main () { int returncode = 0; int i = 0; long numtopics = 0; MYSQL_ROW topicrow; cLogInitDB(); htmlHeader("News Post"); returncode = cLogGetUsername(principalName); if(cLogGetUsername(principalName) >= 20) printf("<p>Database name lookup failure"); if(cLogGetGroups(principalName, principalGroups) >= 20) printf("<p>Database group lookup failure"); if(!strstr(principalGroups,"newspost")) { printf("<p>You are not authorized to post stories"); htmlStaticPrint("footer"); return 1; } sprintf(sqlBuffer, "SELECT * FROM topics"); if(cLogQueryTopicDB() != 0) { printf("<P>Critical Error: Topic lookup failure"); htmlStaticPrint("footer"); exit(EXIT_FAILURE); } numtopics = (long) mysql_num_rows(topicresult); if(numtopics == 0) { printf("<P>Critical Error: Invalid Topic"); htmlStaticPrint("footer"); exit(EXIT_FAILURE); } htmlLeftSide(principalName, principalGroups); htmlStaticPrint("contenttablestart"); printf("<h3>Submit Story</h3><hr />"); printf("<form method=post action=\"post.cgi\">"); printf("<p>Topic: <select name=\"topic\">\n"); for(i = 0; i < numtopics; i++) { topicrow = mysql_fetch_row(topicresult); printf("<option value=\"%s\">%s\n", topicrow[0], topicrow[1]); } printf("</select>\n"); printf("<p>Title: <input name=\"title\" type=text size=\"50\" />"); printf("<p>News Item:<p>"); printf("<textarea wrap=\"virtual\" rows=\"20\" cols=\"75\" name=\"intro\"></textarea><br />"); /* printf("<p>Story Body:<p>"); printf("<textarea wrap=\"virtual\" rows=\"10\" cols=\"50\" name=\"body\"></textarea><BR>"); */ printf("<br />"); printf("<input type=\"SUBMIT\" name=\"button\" Value=\"Submit Story\" />"); printf("<input type=\"SUBMIT\" name=\"button\" Value=\"Preview Story\" />"); printf("<INPUT type=\"RESET\" value=\"Reset\" /></form>"); printf("<h5><center>Allowed HTML tags: <b><b> </b> <i> </i> <a href=\"url\"> and </a><b>. Single Quotes are not allowed.<br />"); printf("Also, URLs starting with http:// or https:// will be converted into links</center></h5>"); htmlStaticPrint("contenttableend"); htmlStaticPrint("footer"); }
int NDSO_Error(int errnum, int form_method, char **getvars, char **postvars, s_info * info) { htmlHeader("NDSO Demo Web Page"); htmlBody(); switch (errnum) { case PPIOPEN: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", PPIOPEN); printf ("<p><font face=\"Tahoma\" size=\"7\">Can't open /dev/ppi.\n</font></p>"); printf ("<p><font face=\"Tahoma\" size=\"7\">- Try again later -\n</font></p>"); free(info->samples); break; case FILE_OPEN: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", FILE_OPEN); printf ("<p><font face=\"Tahoma\" size=\"7\">Can't open FILE.\n</font></p>"); free(info->samples); break; case MEMORY: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", MEMORY); printf ("<p><font face=\"Tahoma\" size=\"7\">Memory allocation error.\n</font></p>"); free(info->samples); break; case SAMPLE_DEPTH: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", SAMPLE_DEPTH); printf ("<p><font face=\"Tahoma\" size=\"7\">Sample Depth outside specified range: [%d] < Depth < [%d] \n</font></p>", MINNUMSAMPLES, MAXNUMSAMPLES); break; case SIZE_RATIO: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", SIZE_RATIO); printf ("<p><font face=\"Tahoma\" size=\"7\">Size Ratio contains invalid characters r exceeds maximum Size Ratio < [%d]\n</font></p>", MAXSIZERATIO); break; case RANGE: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", RANGE); printf ("<p><font face=\"Tahoma\" size=\"7\">Specified Range is invalid or out of range.\n</font></p>"); break; case FILE_OPEN_SAMPLES: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", FILE_OPEN_SAMPLES); printf ("<p><font face=\"Tahoma\" size=\"7\">Can't open SAMPLE FILE for REPLOT.\n</font></p>"); break; case EMPTY_PLOT: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", EMPTY_PLOT); printf ("<p><font face=\"Tahoma\" size=\"7\">Empty Plot increase upper Range.\n</font></p>"); break; default: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[UNDEF]:\n</font></p>"); printf ("<p><font face=\"Tahoma\" size=\"7\">undefined ERROR: \n</font></p>"); break; } htmlFooter(); cleanUp(form_method, getvars, postvars); CleanupSessionFiles(info); fflush(stdout); exit(0); };
int error(int errnum, int form_method, char **getvars, char **postvars) { htmlHeader ("AWG Error"); htmlBody (); switch (errnum) { case ERR_SPI: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_SPI); printf ("<p><font face=\"Tahoma\" size=\"7\">Can't open /dev/spi.\n</font></p>"); printf ("<p><font face=\"Tahoma\" size=\"7\">- Try again later -\n</font></p>"); break; case ERR_FILE: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_FILE); printf ("<p><font face=\"Tahoma\" size=\"7\">Can't open FILE.\n</font></p>"); break; case ERR_MEMORY: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_MEMORY); printf ("<p><font face=\"Tahoma\" size=\"7\">Memory allocation error.\n</font></p>"); break; case ERR_DCOFFSET: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_DCOFFSET); printf ("<p><font face=\"Tahoma\" size=\"7\">DC Offset out of Range %d < Val < %d .\n</font></p>",MINDCOFFSET,MAXDCOFFSET); break; case ERR_AMP: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_AMP); printf ("<p><font face=\"Tahoma\" size=\"7\">Amplitude out of Range %d < Val < %d .\n</font></p>", MINAMP,MAXAMP); break; case ERR_OUTOFRANGE: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_OUTOFRANGE); printf ("<p><font face=\"Tahoma\" size=\"7\"> Out of Range +/- %d Volt.\n</font></p>",MAXAMP); break; case ERR_DUTYCYCLE: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_DUTYCYCLE); printf ("<p><font face=\"Tahoma\" size=\"7\">Duty Cycle out of Range %d < Val < %d .\n</font></p>",MINDUTYCYCLE,MAXDUTYCYCLE); break; case ERR_FREQUENCY: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[%d]:\n</font></p>", ERR_FREQUENCY); printf ("<p><font face=\"Tahoma\" size=\"7\">Frequency out of Range\n</font></p>"); break; default: printf ("<p><font face=\"Tahoma\" size=\"7\">ERROR[UNDEF]:\n</font></p>"); printf ("<p><font face=\"Tahoma\" size=\"7\">undefined ERROR: \n</font></p>"); break; } htmlFooter (); cleanUp (form_method, getvars, postvars); fflush (stdout); exit (1); };
QString htmlizedTextPart(const QModelIndex &partIndex, const QFontInfo &font, const QColor &backgroundColor, const QColor &textColor, const QColor &linkColor, const QColor &visitedLinkColor) { static const QString defaultStyle = QString::fromUtf8( "pre{word-wrap: break-word; white-space: pre-wrap;}" // The following line, sadly, produces a warning "QFont::setPixelSize: Pixel size <= 0 (0)". // However, if it is not in place or if the font size is set higher, even to 0.1px, WebKit reserves space for the // quotation characters and therefore a weird white area appears. Even width: 0px doesn't help, so it looks like // we will have to live with this warning for the time being. ".quotemarks{color:transparent;font-size:0px;}" // Cannot really use the :dir(rtl) selector for putting the quote indicator to the "correct" side. // It's CSS4 and it isn't supported yet. "blockquote{font-size:90%; margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid %1; unicode-bidi: -webkit-plaintext}" // Stop the font size from getting smaller after reaching two levels of quotes // (ie. starting on the third level, don't make the size any smaller than what it already is) "blockquote blockquote blockquote {font-size: 100%}" ".signature{opacity: 0.6;}" // Dynamic quote collapsing via pure CSS, yay "input {display: none}" "input ~ span.full {display: block}" "input ~ span.short {display: none}" "input:checked ~ span.full {display: none}" "input:checked ~ span.short {display: block}" "label {border: 1px solid %2; border-radius: 5px; padding: 0px 4px 0px 4px; white-space: nowrap}" // BLACK UP-POINTING SMALL TRIANGLE (U+25B4) // BLACK DOWN-POINTING SMALL TRIANGLE (U+25BE) "span.full > blockquote > label:before {content: \"\u25b4\"}" "span.short > blockquote > label:after {content: \" \u25be\"}" "span.shortquote > blockquote > label {display: none}" ); QString fontSpecification(QStringLiteral("pre{")); if (font.italic()) fontSpecification += QLatin1String("font-style: italic; "); if (font.bold()) fontSpecification += QLatin1String("font-weight: bold; "); fontSpecification += QStringLiteral("font-size: %1px; font-family: \"%2\", monospace }").arg( QString::number(font.pixelSize()), font.family()); QString textColors = QString::fromUtf8("body { background-color: %1; color: %2 }" "a:link { color: %3 } a:visited { color: %4 } a:hover { color: %3 }").arg( backgroundColor.name(), textColor.name(), linkColor.name(), visitedLinkColor.name()); // looks like there's no special color for hovered links in Qt // build stylesheet and html header QColor tintForQuoteIndicator = backgroundColor; tintForQuoteIndicator.setAlpha(0x66); static QString stylesheet = defaultStyle.arg(linkColor.name(), tintColor(textColor, tintForQuoteIndicator).name()); static QFile file(Common::writablePath(Common::LOCATION_DATA) + QLatin1String("message.css")); static QDateTime lastVersion; QDateTime lastTouched(file.exists() ? QFileInfo(file).lastModified() : QDateTime()); if (lastVersion < lastTouched) { stylesheet = defaultStyle; if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { const QString userSheet = QString::fromLocal8Bit(file.readAll().data()); lastVersion = lastTouched; stylesheet += QLatin1Char('\n') + userSheet; file.close(); } } // The dir="auto" is required for WebKit to treat all paragraphs as entities with possibly different text direction. // The individual paragraphs unfortunately share the same text alignment, though, as per // https://bugs.webkit.org/show_bug.cgi?id=71194 (fixed in Blink already). QString htmlHeader(QLatin1String("<html><head><style type=\"text/css\"><!--") + textColors + fontSpecification + stylesheet + QLatin1String("--></style></head><body><pre dir=\"auto\">")); static QString htmlFooter(QStringLiteral("\n</pre></body></html>")); // We cannot rely on the QWebFrame's toPlainText because of https://bugs.kde.org/show_bug.cgi?id=321160 QString markup = plainTextToHtml(partIndex.data(Imap::Mailbox::RolePartUnicodeText).toString(), flowedFormatForPart(partIndex)); return htmlHeader + markup + htmlFooter; }