Changes On Branch adminTh1
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch adminTh1 Excluding Merge-Ins

This is equivalent to a diff from 558a17a686 to 6358cc3714

2012-12-27
21:16
Add the ability to run TH1 commands from the web interface. check-in: e356f18577 user: drh tags: trunk
03:06
Do not interpret MSIE version 6 and earlier as "human" for the purposes of automatically enabling hyperlinks. check-in: 747e1e50d5 user: drh tags: trunk
2012-12-23
07:23
Add support for running raw TH1 commands via the web interface (requires setup permissions). Closed-Leaf check-in: 6358cc3714 user: mistachkin tags: adminTh1
2012-12-22
14:36
Use NULL rather than 0 for values in the MLINK table that are empty. Leaf check-in: 19844445d0 user: drh tags: exp-foreign-keys
13:48
Update SQLite to the latest trunk, with support for the foreign_key_check pragma. check-in: 558a17a686 user: drh tags: trunk
2012-12-21
13:31
Correct typo in the description of the moderation setup page. check-in: c89a694d54 user: mistachkin tags: trunk

Changes to src/setup.c.

   107    107       "A record of received artifacts and their sources");
   108    108     setup_menu_entry("User-Log", "access_log",
   109    109       "A record of login attempts");
   110    110     setup_menu_entry("Stats", "stat",
   111    111       "Display repository statistics");
   112    112     setup_menu_entry("SQL", "admin_sql",
   113    113       "Enter raw SQL commands");
          114  +  setup_menu_entry("TH1", "admin_th1",
          115  +    "Enter raw TH1 commands");
   114    116     @ </table>
   115    117   
   116    118     style_footer();
   117    119   }
   118    120   
   119    121   /*
   120    122   ** WEBPAGE: setup_ulist
................................................................................
  1757   1759             }
  1758   1760           }
  1759   1761           @ </tr>
  1760   1762         }
  1761   1763         sqlite3_finalize(pStmt);
  1762   1764         @ </table>
  1763   1765       }
         1766  +  }
         1767  +  style_footer();
         1768  +}
         1769  +
         1770  +
         1771  +/*
         1772  +** WEBPAGE: admin_th1
         1773  +**
         1774  +** Run raw TH1 commands using the web interface.  If Tcl integration was
         1775  +** enabled at compile-time and the "tcl" setting is enabled, Tcl commands
         1776  +** may be run as well.
         1777  +*/
         1778  +void th1_page(void){
         1779  +  const char *zQ = P("q");
         1780  +  int go = P("go")!=0;
         1781  +  login_check_credentials();
         1782  +  if( !g.perm.Setup ){
         1783  +    login_needed();
         1784  +  }
         1785  +  db_begin_transaction();
         1786  +  style_header("Raw TH1 Commands");
         1787  +  @ <p><b>Caution:</b> There are no restrictions on the TH1 that can be
         1788  +  @ run by this page.  If Tcl integration was enabled at compile-time and
         1789  +  @ the "tcl" setting is enabled, Tcl commands may be run as well.</p>
         1790  +  @
         1791  +  @ <form method="post" action="%s(g.zTop)/admin_th1">
         1792  +  login_insert_csrf_secret();
         1793  +  @ TH1:<br />
         1794  +  @ <textarea name="q" rows="5" cols="80">%h(zQ)</textarea><br />
         1795  +  @ <input type="submit" name="go" value="Run TH1">
         1796  +  @ </form>
         1797  +  if( go ){
         1798  +    const char *zR;
         1799  +    int rc;
         1800  +    int n;
         1801  +    @ <hr />
         1802  +    login_verify_csrf_secret();
         1803  +    rc = Th_Eval(g.interp, 0, zQ, -1);
         1804  +    zR = Th_GetResult(g.interp, &n);
         1805  +    if( rc==TH_OK ){
         1806  +      @ <pre class="th1result">%h(zR)</pre>
         1807  +    }else{
         1808  +      @ <pre class="th1error">%h(zR)</pre>
         1809  +    }
  1764   1810     }
  1765   1811     style_footer();
  1766   1812   }

Changes to src/style.c.

   992    992       "line numbers in a diff",
   993    993       @   color: #a0a0a0;
   994    994     },
   995    995     { "span.modpending",
   996    996       "Moderation Pending message on timeline",
   997    997       @   color: #b03800;
   998    998       @   font-style: italic;
          999  +  },
         1000  +  { "pre.th1result",
         1001  +    "format for th1 script results",
         1002  +    @   white-space: pre-wrap;
         1003  +    @   word-wrap: break-word;
         1004  +  },
         1005  +  { "pre.th1error",
         1006  +    "format for th1 script errors",
         1007  +    @   white-space: pre-wrap;
         1008  +    @   word-wrap: break-word;
         1009  +    @   color: red;
   999   1010     },
  1000   1011     { 0,
  1001   1012       0,
  1002   1013       0
  1003   1014     }
  1004   1015   };
  1005   1016