| | @@ -1235,11 +1235,11 @@ |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | /* |
| 1238 | 1238 | ** WEBPAGE: setup_logo |
| 1239 | 1239 | ** |
| 1240 | | -** Administrative page for changing the logo image. |
| 1240 | +** Administrative page for changing the logo, background, and icon images. |
| 1241 | 1241 | */ |
| 1242 | 1242 | void setup_logo(void){ |
| 1243 | 1243 | const char *zLogoMtime = db_get_mtime("logo-image", 0, 0); |
| 1244 | 1244 | const char *zLogoMime = db_get("logo-mimetype","image/gif"); |
| 1245 | 1245 | const char *aLogoImg = P("logoim"); |
| | @@ -1246,16 +1246,23 @@ |
| 1246 | 1246 | int szLogoImg = atoi(PD("logoim:bytes","0")); |
| 1247 | 1247 | const char *zBgMtime = db_get_mtime("background-image", 0, 0); |
| 1248 | 1248 | const char *zBgMime = db_get("background-mimetype","image/gif"); |
| 1249 | 1249 | const char *aBgImg = P("bgim"); |
| 1250 | 1250 | int szBgImg = atoi(PD("bgim:bytes","0")); |
| 1251 | + const char *zIconMtime = db_get_mtime("favicon-image", 0, 0); |
| 1252 | + const char *zIconMime = db_get("favicon-mimetype","image/gif"); |
| 1253 | + const char *aIconImg = P("iconim"); |
| 1254 | + int szIconImg = atoi(PD("iconim:bytes","0")); |
| 1251 | 1255 | if( szLogoImg>0 ){ |
| 1252 | 1256 | zLogoMime = PD("logoim:mimetype","image/gif"); |
| 1253 | 1257 | } |
| 1254 | 1258 | if( szBgImg>0 ){ |
| 1255 | 1259 | zBgMime = PD("bgim:mimetype","image/gif"); |
| 1256 | 1260 | } |
| 1261 | + if( szIconImg>0 ){ |
| 1262 | + zIconMime = PD("iconim:mimetype","image/gif"); |
| 1263 | + } |
| 1257 | 1264 | login_check_credentials(); |
| 1258 | 1265 | if( !g.perm.Admin ){ |
| 1259 | 1266 | login_needed(0); |
| 1260 | 1267 | return; |
| 1261 | 1268 | } |
| | @@ -1309,10 +1316,35 @@ |
| 1309 | 1316 | "DELETE FROM config WHERE name IN " |
| 1310 | 1317 | "('background-image','background-mimetype')" |
| 1311 | 1318 | ); |
| 1312 | 1319 | db_end_transaction(0); |
| 1313 | 1320 | cgi_redirect("setup_logo"); |
| 1321 | + }else if( P("seticon")!=0 && zIconMime && zIconMime[0] && szIconImg>0 ){ |
| 1322 | + Blob img; |
| 1323 | + Stmt ins; |
| 1324 | + blob_init(&img, aIconImg, szIconImg); |
| 1325 | + db_prepare(&ins, |
| 1326 | + "REPLACE INTO config(name,value,mtime)" |
| 1327 | + " VALUES('favicon-image',:bytes,now())" |
| 1328 | + ); |
| 1329 | + db_bind_blob(&ins, ":bytes", &img); |
| 1330 | + db_step(&ins); |
| 1331 | + db_finalize(&ins); |
| 1332 | + db_multi_exec( |
| 1333 | + "REPLACE INTO config(name,value,mtime)" |
| 1334 | + " VALUES('favicon-mimetype',%Q,now())", |
| 1335 | + zIconMime |
| 1336 | + ); |
| 1337 | + db_end_transaction(0); |
| 1338 | + cgi_redirect("setup_logo"); |
| 1339 | + }else if( P("clricon")!=0 ){ |
| 1340 | + db_multi_exec( |
| 1341 | + "DELETE FROM config WHERE name IN " |
| 1342 | + "('favicon-image','favicon-mimetype')" |
| 1343 | + ); |
| 1344 | + db_end_transaction(0); |
| 1345 | + cgi_redirect("setup_logo"); |
| 1314 | 1346 | } |
| 1315 | 1347 | style_header("Edit Project Logo And Background"); |
| 1316 | 1348 | @ <p>The current project logo has a MIME-Type of <b>%h(zLogoMime)</b> |
| 1317 | 1349 | @ and looks like this:</p> |
| 1318 | 1350 | @ <blockquote><p><img src="%s(g.zTop)/logo/%z(zLogoMtime)" \ |
| | @@ -1358,10 +1390,34 @@ |
| 1358 | 1390 | @ <input type="submit" name="setbg" value="Change Background" /> |
| 1359 | 1391 | @ <input type="submit" name="clrbg" value="Revert To Default" /></p> |
| 1360 | 1392 | @ </div></form> |
| 1361 | 1393 | @ <p>(Properties: "background-image" and "background-mimetype") |
| 1362 | 1394 | @ <hr /> |
| 1395 | + @ |
| 1396 | + @ <p>The current icon image has a MIME-Type of <b>%h(zIconMime)</b> |
| 1397 | + @ and looks like this:</p> |
| 1398 | + @ <blockquote><p><img src="%s(g.zTop)/favicon.ico/%z(zIconMtime)" \ |
| 1399 | + @ alt="icon" border=1 /> |
| 1400 | + @ </p></blockquote> |
| 1401 | + @ |
| 1402 | + @ <form action="%s(g.zTop)/setup_logo" method="post" |
| 1403 | + @ enctype="multipart/form-data"><div> |
| 1404 | + @ <p>The icon image is accessible to all users at this URL: |
| 1405 | + @ <a href="%s(g.zBaseURL)/favicon.ico">%s(g.zBaseURL)/favicon.ico</a>. |
| 1406 | + @ The icon image may or may not appear on each |
| 1407 | + @ page depending on the web browser in use and the MIME-Types that it |
| 1408 | + @ supports for icon images. |
| 1409 | + @ To change the icon image, use the following form:</p> |
| 1410 | + login_insert_csrf_secret(); |
| 1411 | + @ Icon image file: |
| 1412 | + @ <input type="file" name="iconim" size="60" accept="image/*" /> |
| 1413 | + @ <p align="center"> |
| 1414 | + @ <input type="submit" name="seticon" value="Change Icon" /> |
| 1415 | + @ <input type="submit" name="clricon" value="Revert To Default" /></p> |
| 1416 | + @ </div></form> |
| 1417 | + @ <p>(Properties: "favicon-image" and "favicon-mimetype") |
| 1418 | + @ <hr /> |
| 1363 | 1419 | @ |
| 1364 | 1420 | @ <p><span class="note">Note:</span> Your browser has probably cached these |
| 1365 | 1421 | @ images, so you may need to press the Reload button before changes will |
| 1366 | 1422 | @ take effect. </p> |
| 1367 | 1423 | style_footer(); |
| 1368 | 1424 | |