Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch multiple-skins Excluding Merge-Ins
This is equivalent to a diff from 236087b98e to b36e241100
2015-01-22
| ||
15:32 | Add missing style to the default skin CSS. Also, correct some comments. check-in: 03a75d7cb5 user: mistachkin tags: trunk | |
15:23 | Add the ability to bring up a web server that uses a different skin from the default, and have multiple servers going at the same time, each using a different skin. Currently enabled for unix only. (Later:) Upon further reflection, I'm not convinced this is a good idea, so the code is moved into a branch. Closed-Leaf check-in: b36e241100 user: drh tags: multiple-skins | |
13:44 | Add comments the CGI-script parser. Move the most commonly seen lines to the top of the if-then-else chain. check-in: 236087b98e user: drh tags: trunk | |
12:37 | Add a few "const" qualifiers in appropriate places, and remove some unnecessary end-of-line spaces. No change in functionality. check-in: f6c285f88c user: jan.nijtmans tags: trunk | |
Changes to src/configure.c.
︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - - - + + + | ** single entries in the CONFIG table. Setting names that begin with ** "@" are for special processing. */ static struct { const char *zName; /* Name of the configuration parameter */ int groupMask; /* Which config groups is it part of */ } aConfig[] = { |
︙ |
Changes to src/db.c.
︙ | |||
1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 | 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + - + - + - + + | " with \"fossil unset %s\")", zName, zName, zName, zName ); } /* Prefer the versioned setting */ return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting; } /* ** Translate a local CONFIG parameter name based on the g.zSkin setting ** and return a pointer to the new name. ** ** The returned string is only valid until the next call to this routine. ** ** If g.zSkin==0 (which is the overwhelmingly common case) then just ** return zName immediately, without change. But if g.zSkin is set and ** if zName is one of the CONFIG parameters that affect the screen ** appearance, then return a copy of zName with "("+g.zSkin+")" appended. ** Space to hold the copy is managed locally and is freed on the next ** call to this routine. */ const char *db_skin_name(const char *zName){ static const char *azSkinVars[] = { /* These are the names of CONFIG */ "adunit", /* variables that affect appearance. */ "adunit-omit-if-admin", /* Keep this list in sorted order, */ "adunit-omit-if-user", /* and in sync with the list of */ "background-image", /* CONFIGSET_SKIN and CONFIGSET_CSS */ "background-mimetype", /* names in configure.c */ "css", "footer", "header", "index-page", "logo-image", "logo-mimetype", "timeline-block-markup", "timeline-max-comment", "timeline-plaintext", }; int i, c, lwr, upr; static char *zToFree = 0; if( g.zSkin==0 ) return zName; /* The common case */ if( zToFree ){ fossil_free(zToFree); zToFree = 0; } lwr = 0; upr = sizeof(azSkinVars)/sizeof(azSkinVars[0])-1; while( lwr<=upr ){ i = (lwr+upr)/2; c = fossil_strcmp(azSkinVars[i], zName); if( c<0 ){ lwr = i+1; }else if( c>0 ){ upr = i-1; }else{ zToFree = mprintf("%s(%s)", zName, g.zSkin); return zToFree; } } return zName; } /* ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the ** repository and local databases. */ char *db_get(const char *zName, char *zDefault){ char *z = 0; int i; const struct stControlSettings *ctrlSetting = 0; /* Is this a setting? */ for(i=0; ctrlSettings[i].name; i++){ if( strcmp(ctrlSettings[i].name, zName)==0 ){ ctrlSetting = &(ctrlSettings[i]); break; } } if( g.repositoryOpen ){ |
︙ | |||
2075 2076 2077 2078 2079 2080 2081 | 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 | - + | if( globalFlag ){ db_swap_connections(); db_multi_exec("REPLACE INTO global_config(name,value) VALUES(%Q,%d)", zName, value); db_swap_connections(); }else{ db_multi_exec("REPLACE INTO config(name,value,mtime) VALUES(%Q,%d,now())", |
︙ |
Changes to src/main.c.
︙ | |||
147 148 149 150 151 152 153 154 155 156 157 158 159 160 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | + | int fHttpTrace; /* Trace outbound HTTP requests */ char *zHttpAuth; /* HTTP Authorization user:pass information */ int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ int fSshTrace; /* Trace the SSH setup traffic */ int fSshClient; /* HTTP client flags for SSH client */ char *zSshCmd; /* SSH command string */ int fNoSync; /* Do not do an autosync ever. --nosync */ const char *zSkin; /* Alternative webpage skin name */ char *zPath; /* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ char *zHttpsURL; /* zBaseURL translated to https: */ char *zTop; /* Parent directory of zPath */ const char *zContentType; /* The content type of the input HTTP request */ int iErrPriority; /* Priority of current error message */ |
︙ | |||
1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | + + + + + + + + + + + | ** for files that match any of these GLOBs and if any such file is ** found it is returned verbatim. This feature allows "fossil server" ** to function as a primitive web-server delivering arbitrary content. */ pFileGlob = glob_create(blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "skin:") && blob_token(&line, &value) ){ /* skin: NAME ** ** Use an alternative "skin" for this instance. NAME is the name ** of the alternative skin to use. See comments on db_skin_name() ** for addition information. */ g.zSkin = mprintf("%s", blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "setenv:") && blob_token(&line, &value) && blob_token(&line, &value2) ){ /* setenv: NAME VALUE ** ** Sets environment variable NAME to VALUE */ |
︙ | |||
1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 | 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 | + | ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --nossl signal that no SSL connections are available ** --notfound URL use URL as "HTTP 404, object not found" page. ** --files GLOB comma-separate glob patterns for static file to serve ** --baseurl URL base URL (useful with reverse proxies) ** --scgi Interpret input as SCGI rather than HTTP ** --skin NAME Use an alternative labeled NAME ** ** See also: cgi, server, winsrv */ void cmd_http(void){ const char *zIpAddr = 0; const char *zNotFound; const char *zHost; |
︙ | |||
2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 | 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | + | zFileGlob = z; }else{ zFileGlob = find_option("files",0,1); } zNotFound = find_option("notfound", 0, 1); g.useLocalauth = find_option("localauth", 0, 0)!=0; g.sslNotAvailable = find_option("nossl", 0, 0)!=0; g.zSkin = find_option("skin", 0, 1); useSCGI = find_option("scgi", 0, 0)!=0; zAltBase = find_option("baseurl", 0, 1); if( zAltBase ) set_base_url(zAltBase); if( find_option("https",0,0)!=0 ){ zIpAddr = fossil_getenv("REMOTE_HOST"); /* From stunnel */ cgi_replace_parameter("HTTPS","on"); } |
︙ | |||
2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 | 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | + | zFileGlob = find_option("files",0,1); } g.useLocalauth = find_option("localauth", 0, 0)!=0; Th_InitTraceLog(); zPort = find_option("port", "P", 1); zNotFound = find_option("notfound", 0, 1); zAltBase = find_option("baseurl", 0, 1); g.zSkin = find_option("skin",0,1); if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; if( zAltBase ){ set_base_url(zAltBase); } if( find_option("localhost", 0, 0)!=0 ){ flags |= HTTP_SERVER_LOCALHOST; } |
︙ |
Changes to src/setup.c.
︙ | |||
1798 1799 1800 1801 1802 1803 1804 | 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 | - + + - - + + - + - - + - - + + - - + + - + - - + - | db_begin_transaction(); if( P("setlogo")!=0 && zLogoMime && zLogoMime[0] && szLogoImg>0 ){ Blob img; Stmt ins; blob_init(&img, aLogoImg, szLogoImg); db_prepare(&ins, "REPLACE INTO config(name,value,mtime)" |
︙ |
Changes to src/skins.c.
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | + + + - + + | ** Return NULL if zSkinName is NULL or an empty string. ** ** If ifExists is true, and the named skin does not exist, return NULL. */ static char *skinVarName(const char *zSkinName, int ifExists){ char *z; if( zSkinName==0 || zSkinName[0]==0 ) return 0; if( g.zSkin ){ z = mprintf("skin(%s):%s", g.zSkin, zSkinName); }else{ |
︙ | |||
94 95 96 97 98 99 100 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - + | zLabel = mprintf("skins/default/%s.txt", azType[i]); z = builtin_text(zLabel); fossil_free(zLabel); } } blob_appendf(&val, "REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now());\n", |
︙ | |||
164 165 166 167 168 169 170 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | - - + + + + - - - + + + | for(i=0; i<sizeof(aBuiltinSkin)/sizeof(aBuiltinSkin[0]); i++){ if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ seen = 1; break; } } if( !seen ){ |
︙ | |||
217 218 219 220 221 222 223 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | - - + + + + | @ <input type="submit" name="load" value="Install" /> @ </form> } @ </tr> } db_prepare(&q, "SELECT substr(name, 6), value FROM config" |
︙ |
Changes to src/style.c.
︙ | |||
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | + + + | } zCap[i] = 0; @ g.userUid = %d(g.userUid)<br /> @ g.zLogin = %h(g.zLogin)<br /> @ g.isHuman = %d(g.isHuman)<br /> @ capabilities = %s(zCap)<br /> @ g.zRepositoryName = %h(g.zRepositoryName)<br /> if( g.zSkin ){ @ g.zSkin = %h(g.zSkin)<br /> } @ load_average() = %f(load_average())<br /> @ <hr> P("HTTP_USER_AGENT"); cgi_print_all(showAll); if( showAll && blob_size(&g.httpHeader)>0 ){ @ <hr> @ <pre> |
︙ |