| 2699 | |
| 2700 | |
| 2701 | int ph_run_pi_cmd(int mod, int cmd, |
| 2702 | void *connection, void *con_cls, |
| 2703 | str *page, str *buffer) |
| 2704 | { |
| 2705 | char *p; |
| 2706 | char *buf; |
| 2707 | int ret; |
| 2708 | |
| 2709 | str s_arg; |
| 2710 | str l_arg; |
| 2711 | str temp_holder; |
| 2712 | int temp_counter; |
| 2713 | int i; |
| 2714 | int j; |
| 2715 | int max_page_len; |
| 2716 | ph_cmd_t *command; |
| 2717 | |
| 2718 | int _len; |
| 2719 | int link_on; |
| 2720 | |
| 2721 | char tmp; |
| 2722 | char c[2]; |
| 2723 | db_val_t *c_vals = NULL; |
| 2724 | db_val_t *q_vals = NULL; |
| 2725 | db_val_t *val; |
| 2726 | str val_str = {NULL, 0}; |
| 2727 | int nr_rows; |
| 2728 | ph_db_url_t *db_url = NULL; |
| 2729 | db_res_t *res = NULL; |
| 2730 | db_val_t *values = NULL; |
| 2731 | db_row_t *rows; |
| 2732 | ph_mod_t *ph_modules; |
| 2733 | |
| 2734 | ph_modules = ph_framework_data->ph_modules; |
| 2735 | |
| 2736 | html_page_data.page.s = buffer->s; |
| 2737 | html_page_data.page.len = 0; |
| 2738 | html_page_data.buffer.s = buffer->s; |
| 2739 | html_page_data.buffer.len = buffer->len; |
| 2740 | html_page_data.mod = mod; |
| 2741 | html_page_data.cmd = cmd; |
| 2742 | max_page_len = buffer->len; |
| 2743 | |
| 2744 | if (0!=ph_build_header(page, buffer->len, mod, cmd)) return -1; |
| 2745 | buf = page->s; |
| 2746 | p = page->s + page->len; |
| 2747 | |
| 2748 | if (cmd<0) return ph_build_content(page, buffer->len, mod, cmd, NULL, NULL); |
| 2749 | |
| 2750 | httpd_api.lookup_arg(connection, "cmd", con_cls, &l_arg); |
| 2751 | if(l_arg.s==NULL) return ph_build_content(page, buffer->len, mod, cmd, NULL, NULL); |
| 2752 | |
| 2753 | LM_DBG("got arg cmd=[%.*s]\n", l_arg.len, l_arg.s); |
| 2754 | |
| 2755 | command = &ph_modules[mod].cmds[cmd]; |
| 2756 | |
| 2757 | if (l_arg.len==3 && strncmp(l_arg.s, "pre", 3)==0) { |
| 2758 | /* We prebuild values only for update */ |
no test coverage detected