function sms_poll_hook_webservices_output($operation, $requests) { global $core_config; $ret = ''; if ($poll_keyword = $requests['keyword']) { $list = dba_search(_DB_PREF_ . '_featurePoll', 'poll_id,poll_access_code', array('poll_keyword' => $poll_keyword)); $poll_id = $list[0]['poll_id']; $poll_access_code = $list[0]['poll_access_code']; } $code = $requests['code']; if ($poll_id && $code == $poll_access_code) { $type = $requests['type']; switch ($type) { case 'serialize': $ret = sms_poll_output_serialize($poll_id, $poll_keyword); break; case 'json': $ret = sms_poll_output_json($poll_id, $poll_keyword); break; case 'xml': ob_end_clean(); header('Content-type: text/xml'); $ret = sms_poll_output_xml($poll_id, $poll_keyword); break; case 'html': ob_end_clean(); header('Content-type: text/html'); $ret = sms_poll_output_html($poll_id, $poll_keyword); break; case 'graph': $ret = sms_poll_output_graph($poll_id, $poll_keyword); break; } } return $ret; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with playSMS. If not, see <http://www.gnu.org/licenses/>. */ defined('_SECURE_') or die('Forbidden'); if (!auth_isvalid()) { auth_block(); } $poll_id = $_REQUEST['poll_id']; switch (_OP_) { case 'list': $conditions['poll_id'] = $poll_id; $list = dba_search(_DB_PREF_ . '_featurePoll', '*', $conditions); $poll_keyword = $list[0]['poll_keyword']; $poll_access_code = $list[0]['poll_access_code']; $output_serialize = $core_config['http_path']['base'] . "/index.php?app=webservices&op=sms_poll&keyword=" . urlencode($poll_keyword) . "&code=" . $poll_access_code . "&type=serialize"; $output_json = $core_config['http_path']['base'] . "/index.php?app=webservices&op=sms_poll&keyword=" . urlencode($poll_keyword) . "&code=" . $poll_access_code . "&type=json"; $output_xml = $core_config['http_path']['base'] . "/index.php?app=webservices&op=sms_poll&keyword=" . urlencode($poll_keyword) . "&code=" . $poll_access_code . "&type=xml"; $output_html = $core_config['http_path']['base'] . "/index.php?app=webservices&op=sms_poll&keyword=" . urlencode($poll_keyword) . "&code=" . $poll_access_code . "&type=html"; $output_graph = $core_config['http_path']['base'] . "/index.php?app=webservices&op=sms_poll&keyword=" . urlencode($poll_keyword) . "&code=" . $poll_access_code . "&type=graph"; $stat = sms_poll_statistics($poll_id); if ($err = $_SESSION['error_string']) { $content = "<div class=error_string>{$err}</div>"; } $content .= "\n\t\t\t<h2>" . _('Manage poll') . "</h2>\n\t\t\t<h3>" . _('Keyword') . " : " . $poll_keyword . "</h3>\n\t\t\t\n\t\t\t<h3>" . _('Statistics') . "</h3>\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tr><td class=label-sizer>" . _('Senders sent once') . "</td><td width=5>:</td><td>" . $stat['once'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Senders sent multiple votes') . "</td><td>:</td><td>" . $stat['multi'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Grand total senders') . "</td><td>:</td><td>" . $stat['sender'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Total one time vote SMS') . "</td><td>:</td><td>" . $stat['once_sms'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Total multiple votes SMS') . "</td><td>:</td><td>" . $stat['multi_sms'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Total valid SMS') . "</td><td>:</td><td>" . $stat['valid'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Total invalid SMS') . "</td><td>:</td><td>" . $stat['invalid'] . "</td></tr>\n\t\t\t\t<tr><td>" . _('Grand total SMS') . "</td><td>:</td><td>" . $stat['all'] . "</td></tr>\n\t\t\t</table>\n\n\t\t\t<h3>" . _('Result table') . "</h3>\n\t\t\t" . sms_poll_output_html($poll_id, $poll_keyword) . "\n\t\t\t\n\t\t\t<h3>" . _('Result graph') . "</h3>\n\t\t\t<img src=\"" . $output_graph . "\">\n\t\t\t\t\t\n\t\t\t<h3>" . _('Webservices links') . "</h3>\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tr><td class=label-sizer>" . _('PHP serialize output') . "</td><td width=5>:</td><td><a href=\"" . _u($output_serialize) . "\" target=_blank>" . _u($output_serialize) . "</a></td></tr>\n\t\t\t\t<tr><td>" . _('JSON output') . "</td><td>:</td><td><a href=\"" . _u($output_json) . "\" target=_blank>" . _u($output_json) . "</a></td></tr>\n\t\t\t\t<tr><td>" . _('XML output') . "</td><td>:</td><td><a href=\"" . _u($output_xml) . "\" target=_blank>" . _u($output_xml) . "</a></td></tr>\n\t\t\t\t<tr><td>" . _('HTML output') . "</td><td>:</td><td><a href=\"" . _u($output_html) . "\" target=_blank>" . _u($output_html) . "</a></td></tr>\n\t\t\t\t<tr><td>" . _('Graph output') . "</td><td>:</td><td><a href=\"" . _u($output_graph) . "\" target=_blank>" . _u($output_graph) . "</a></td></tr>\n\t\t\t</table>"; $content .= '<p>' . _back('index.php?app=main&inc=feature_sms_poll&op=sms_poll_list'); _p($content); break; }