Fossil SCM
If the first term of the PATH_INFO is "skn_X" where X is one of the built-in skin names, then use that built-in skin rather than whatever is configured.
Commit
7b028d74a6acd6d5794d78ef00e280208b23cf4ebfa277702bd1eaaa6f23075f
Parent
0412039ef108fb6…
1 file changed
+29
-4
+29
-4
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1790,13 +1790,19 @@ | ||
| 1790 | 1790 | } |
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | 1793 | /* At this point, the appropriate repository database file will have |
| 1794 | 1794 | ** been opened. |
| 1795 | - ** | |
| 1796 | - ** Check to see if the PATH_INFO begins with "draft[1-9]" and if | |
| 1797 | - ** so activate the special handling for draft skins | |
| 1795 | + */ | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + /* | |
| 1799 | + ** Check to see if the first term of PATH_INFO specifies an alternative | |
| 1800 | + ** skin. This will be the case if the first term of PATH_INFO | |
| 1801 | + ** begins with "draftN/" where N is an integer between 1 and 9 or | |
| 1802 | + ** if it is "skn_X/" where X is one of the built-in skin names. | |
| 1803 | + ** If either is true, then activate the alternative skin. | |
| 1798 | 1804 | */ |
| 1799 | 1805 | if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0 |
| 1800 | 1806 | && zPathInfo[6]>='1' && zPathInfo[6]<='9' |
| 1801 | 1807 | && (zPathInfo[7]=='/' || zPathInfo[7]==0) |
| 1802 | 1808 | ){ |
| @@ -1808,11 +1814,30 @@ | ||
| 1808 | 1814 | if( g.zBaseURL ) g.zBaseURL = mprintf("%s/draft%d", g.zBaseURL, iSkin); |
| 1809 | 1815 | zPathInfo += 7; |
| 1810 | 1816 | cgi_replace_parameter("PATH_INFO", zPathInfo); |
| 1811 | 1817 | cgi_replace_parameter("SCRIPT_NAME", zNewScript); |
| 1812 | 1818 | etag_cancel(); |
| 1813 | - } | |
| 1819 | + }else if( zPathInfo && strncmp(zPathInfo, "/skn_", 5)==0 ){ | |
| 1820 | + int i; | |
| 1821 | + char *zAlt; | |
| 1822 | + char *zErr; | |
| 1823 | + for(i=5; zPathInfo[i] && zPathInfo[i]!='/'; i++){} | |
| 1824 | + zAlt = mprintf("%.*s", i-5, zPathInfo+5); | |
| 1825 | + zErr = skin_use_alternative(zAlt); | |
| 1826 | + if( zErr ){ | |
| 1827 | + fossil_free(zErr); | |
| 1828 | + }else{ | |
| 1829 | + char *zNewScript; | |
| 1830 | + zNewScript = mprintf("%T/skn_%s", P("SCRIPT_NAME"), zAlt); | |
| 1831 | + if( g.zTop ) g.zTop = mprintf("%R/skn_%s", zAlt); | |
| 1832 | + if( g.zBaseURL ) g.zBaseURL = mprintf("%s/skn_%s", g.zBaseURL, zAlt); | |
| 1833 | + zPathInfo += i; | |
| 1834 | + cgi_replace_parameter("PATH_INFO", zPathInfo); | |
| 1835 | + cgi_replace_parameter("SCRIPT_NAME", zNewScript); | |
| 1836 | + } | |
| 1837 | + fossil_free(zAlt); | |
| 1838 | + } | |
| 1814 | 1839 | |
| 1815 | 1840 | /* If the content type is application/x-fossil or |
| 1816 | 1841 | ** application/x-fossil-debug, then a sync/push/pull/clone is |
| 1817 | 1842 | ** desired, so default the PATH_INFO to /xfer |
| 1818 | 1843 | */ |
| 1819 | 1844 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1790,13 +1790,19 @@ | |
| 1790 | } |
| 1791 | } |
| 1792 | |
| 1793 | /* At this point, the appropriate repository database file will have |
| 1794 | ** been opened. |
| 1795 | ** |
| 1796 | ** Check to see if the PATH_INFO begins with "draft[1-9]" and if |
| 1797 | ** so activate the special handling for draft skins |
| 1798 | */ |
| 1799 | if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0 |
| 1800 | && zPathInfo[6]>='1' && zPathInfo[6]<='9' |
| 1801 | && (zPathInfo[7]=='/' || zPathInfo[7]==0) |
| 1802 | ){ |
| @@ -1808,11 +1814,30 @@ | |
| 1808 | if( g.zBaseURL ) g.zBaseURL = mprintf("%s/draft%d", g.zBaseURL, iSkin); |
| 1809 | zPathInfo += 7; |
| 1810 | cgi_replace_parameter("PATH_INFO", zPathInfo); |
| 1811 | cgi_replace_parameter("SCRIPT_NAME", zNewScript); |
| 1812 | etag_cancel(); |
| 1813 | } |
| 1814 | |
| 1815 | /* If the content type is application/x-fossil or |
| 1816 | ** application/x-fossil-debug, then a sync/push/pull/clone is |
| 1817 | ** desired, so default the PATH_INFO to /xfer |
| 1818 | */ |
| 1819 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1790,13 +1790,19 @@ | |
| 1790 | } |
| 1791 | } |
| 1792 | |
| 1793 | /* At this point, the appropriate repository database file will have |
| 1794 | ** been opened. |
| 1795 | */ |
| 1796 | |
| 1797 | |
| 1798 | /* |
| 1799 | ** Check to see if the first term of PATH_INFO specifies an alternative |
| 1800 | ** skin. This will be the case if the first term of PATH_INFO |
| 1801 | ** begins with "draftN/" where N is an integer between 1 and 9 or |
| 1802 | ** if it is "skn_X/" where X is one of the built-in skin names. |
| 1803 | ** If either is true, then activate the alternative skin. |
| 1804 | */ |
| 1805 | if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0 |
| 1806 | && zPathInfo[6]>='1' && zPathInfo[6]<='9' |
| 1807 | && (zPathInfo[7]=='/' || zPathInfo[7]==0) |
| 1808 | ){ |
| @@ -1808,11 +1814,30 @@ | |
| 1814 | if( g.zBaseURL ) g.zBaseURL = mprintf("%s/draft%d", g.zBaseURL, iSkin); |
| 1815 | zPathInfo += 7; |
| 1816 | cgi_replace_parameter("PATH_INFO", zPathInfo); |
| 1817 | cgi_replace_parameter("SCRIPT_NAME", zNewScript); |
| 1818 | etag_cancel(); |
| 1819 | }else if( zPathInfo && strncmp(zPathInfo, "/skn_", 5)==0 ){ |
| 1820 | int i; |
| 1821 | char *zAlt; |
| 1822 | char *zErr; |
| 1823 | for(i=5; zPathInfo[i] && zPathInfo[i]!='/'; i++){} |
| 1824 | zAlt = mprintf("%.*s", i-5, zPathInfo+5); |
| 1825 | zErr = skin_use_alternative(zAlt); |
| 1826 | if( zErr ){ |
| 1827 | fossil_free(zErr); |
| 1828 | }else{ |
| 1829 | char *zNewScript; |
| 1830 | zNewScript = mprintf("%T/skn_%s", P("SCRIPT_NAME"), zAlt); |
| 1831 | if( g.zTop ) g.zTop = mprintf("%R/skn_%s", zAlt); |
| 1832 | if( g.zBaseURL ) g.zBaseURL = mprintf("%s/skn_%s", g.zBaseURL, zAlt); |
| 1833 | zPathInfo += i; |
| 1834 | cgi_replace_parameter("PATH_INFO", zPathInfo); |
| 1835 | cgi_replace_parameter("SCRIPT_NAME", zNewScript); |
| 1836 | } |
| 1837 | fossil_free(zAlt); |
| 1838 | } |
| 1839 | |
| 1840 | /* If the content type is application/x-fossil or |
| 1841 | ** application/x-fossil-debug, then a sync/push/pull/clone is |
| 1842 | ** desired, so default the PATH_INFO to /xfer |
| 1843 | */ |
| 1844 |