Fossil SCM
Allow multiple layers of /skn_X skin specifications at the beginning of the PATH_INFO. Use the last one. Skip over and discard all the others.
Commit
5af8a1a937393c81f2b7d276fcc4264f050db69d97b95fe83910452ad3f40f6f
Parent
685c7d0581eff14…
1 file changed
+8
-1
+8
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1798,11 +1798,16 @@ | ||
| 1798 | 1798 | /* |
| 1799 | 1799 | ** Check to see if the first term of PATH_INFO specifies an alternative |
| 1800 | 1800 | ** skin. This will be the case if the first term of PATH_INFO |
| 1801 | 1801 | ** begins with "draftN/" where N is an integer between 1 and 9 or |
| 1802 | 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. | |
| 1803 | + ** If either is true, then activate the alternative skin.a | |
| 1804 | + ** | |
| 1805 | + ** If there are multiple skn_X entries (ex: /skn_default/skn_ardoise/...) | |
| 1806 | + ** then skip over all but the last. This allows one to link to an | |
| 1807 | + ** alternative skin in hyperlinks even if you are already in an alternative | |
| 1808 | + ** skin. | |
| 1804 | 1809 | */ |
| 1805 | 1810 | if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0 |
| 1806 | 1811 | && zPathInfo[6]>='1' && zPathInfo[6]<='9' |
| 1807 | 1812 | && (zPathInfo[7]=='/' || zPathInfo[7]==0) |
| 1808 | 1813 | ){ |
| @@ -1818,10 +1823,12 @@ | ||
| 1818 | 1823 | etag_cancel(); |
| 1819 | 1824 | }else if( zPathInfo && strncmp(zPathInfo, "/skn_", 5)==0 ){ |
| 1820 | 1825 | int i; |
| 1821 | 1826 | char *zAlt; |
| 1822 | 1827 | char *zErr; |
| 1828 | + char *z; | |
| 1829 | + while( (z = strstr(zPathInfo+1,"/skn_"))!=0 ) zPathInfo = z; | |
| 1823 | 1830 | for(i=5; zPathInfo[i] && zPathInfo[i]!='/'; i++){} |
| 1824 | 1831 | zAlt = mprintf("%.*s", i-5, zPathInfo+5); |
| 1825 | 1832 | zErr = skin_use_alternative(zAlt); |
| 1826 | 1833 | if( zErr ){ |
| 1827 | 1834 | fossil_free(zErr); |
| 1828 | 1835 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1798,11 +1798,16 @@ | |
| 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 | ){ |
| @@ -1818,10 +1823,12 @@ | |
| 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 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1798,11 +1798,16 @@ | |
| 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.a |
| 1804 | ** |
| 1805 | ** If there are multiple skn_X entries (ex: /skn_default/skn_ardoise/...) |
| 1806 | ** then skip over all but the last. This allows one to link to an |
| 1807 | ** alternative skin in hyperlinks even if you are already in an alternative |
| 1808 | ** skin. |
| 1809 | */ |
| 1810 | if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0 |
| 1811 | && zPathInfo[6]>='1' && zPathInfo[6]<='9' |
| 1812 | && (zPathInfo[7]=='/' || zPathInfo[7]==0) |
| 1813 | ){ |
| @@ -1818,10 +1823,12 @@ | |
| 1823 | etag_cancel(); |
| 1824 | }else if( zPathInfo && strncmp(zPathInfo, "/skn_", 5)==0 ){ |
| 1825 | int i; |
| 1826 | char *zAlt; |
| 1827 | char *zErr; |
| 1828 | char *z; |
| 1829 | while( (z = strstr(zPathInfo+1,"/skn_"))!=0 ) zPathInfo = z; |
| 1830 | for(i=5; zPathInfo[i] && zPathInfo[i]!='/'; i++){} |
| 1831 | zAlt = mprintf("%.*s", i-5, zPathInfo+5); |
| 1832 | zErr = skin_use_alternative(zAlt); |
| 1833 | if( zErr ){ |
| 1834 | fossil_free(zErr); |
| 1835 |