Example #1
0
 public static void requestEnd(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     bool cookiesEnabled = request.Cookies["cookie-control"] != null;
     // Add styling and toggle button
     Misc.Plugins.addHeaderCSS(pageElements["URL"] + "/Content/CSS/CookieControl.css", ref pageElements);
     Misc.Plugins.addHeaderJS(pageElements["URL"] + "/Content/JS/CookieControl.js", ref pageElements);
     // Add toggle button
     pageElements.appendToKey("BODY_FOOTER", Core.templates["cookiecontrol"]["toggle"]);
     // Add warning banner
     if (!cookiesEnabled)
         pageElements.appendToKey("BODY_HEADER", Core.templates["cookiecontrol"]["banner"]);
     else
     {
         // Check if cookies have been enabled, if so return - no need to remove cookies
         pageElements.setFlag("COOKIES_ON");
         return;
     }
     // Clear all the response cookies - these may have been added programmatically
     response.Cookies.Clear();
     // Add each cookie, sent in the request, in the response - to expire
     HttpCookie cookie;
     for (int i = 0; i < request.Cookies.Count; i++)
     {
         cookie = request.Cookies[i];
         if (cookie.Name != "ASP.NET_SessionId")
         {
             cookie.Expires = DateTime.Now.AddDays(-2);
             response.Cookies.Add(cookie);
         }
     }
 }
Example #2
0
 /// <summary>
 /// This is required to insert the required dependencies for formatted pages; this is only needed for e.g. cached or preview documents.
 /// </summary>
 public static void formatIncludes(HttpRequest request, HttpResponse response, Connector connector, ref Misc.PageElements pageElements, bool formattingText, bool formattingObjects)
 {
     if(formattingText || formattingObjects)
         Misc.Plugins.addHeaderCssOnce(pageElements["URL"] + "/Content/CSS/Common.css", ref pageElements);
     if (formattingObjects)
     {
         // Code syntax highlighter: base
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shCore.js", ref pageElements);
         Misc.Plugins.addHeaderCssOnce(pageElements["URL"] + "/Content/CSS/Common/shCore.css", ref pageElements);
         Misc.Plugins.addHeaderCssOnce(pageElements["URL"] + "/Content/CSS/Common/shThemeDefault.css", ref pageElements);
         // Code syntax highlighter: languages - admittedly this is heavy...
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushAS3.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushBash.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushColdFusion.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushCpp.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushCSharp.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushCss.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushDelphi.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushJava.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushJScript.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushPerl.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushPhp.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushPowerShell.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushPython.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushRuby.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushScala.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushSql.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushVb.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushXml.js", ref pageElements);
         Misc.Plugins.addHeaderJsOnce(pageElements["URL"] + "/Content/JS/Common/shBrushPlain.js", ref pageElements);
         pageElements.appendToKey("BODY_FOOTER", "<script type=\"text/javascript\">SyntaxHighlighter.all()</script>");
     }
 }