wrote this file. * As long as you retain this notice you can do whatever you want with this * software. If we meet some day, and you think this stuff is worth it, you can * buy me a beer in return. * Sandino Araico Sánchez * --LICENCIA EN ESPAÑOL MEXICANO---------------------------------------------- * "LA LICENCIA BEER-WARE" (traducción al español de la revisión 42-sandino-3): * Sandino Araico Sánchez escribió éste archivo. * Siempre y cuando usted retenga éste aviso (en español y en inglés) usted * puede hacer cualquier cosa con éste software. Si algún día nos encontramos y * usted piensa que éste software vale la pena, usted puede invitarme una * cerveza en recompensa. * Sandino Araico Sánchez * --FIN DE LICENCIA----------------------------------------------------------- */ # Changelog: # 2001-09-17 Sandino Araico Sánchez # Pegamento de polls de HOPP para Ascend # 2001-09-25 Sandino Araico Sánchez # Desascendificación de la librería # 2001-10-01 Sandino Araico Sánchez # Fixed old caché bug # Independized votes submision process # Results # 2001-10-03 Sandino Araico Sánchez # h_poll_results() # 2001-11-20 Sandino Araico Sánchez # Fixed h_poll_submit_votes(), avoid multiple votes if(!defined("__HOPP_GLUE")) { define("__HOPP_GLUE",1); #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ function h_poll($id=0, $template_name="poll") { print h_poll_get_poll($id, $template_name); } function h_poll_results($id=0, $template_name="poll") { $id=hopp_db_connected($id); print h_poll_get_results($id, $template_name); } function h_poll_get_poll($id=0, $template_name="poll") { $id=hopp_db_connected($id); global $H_PLL_SUBMIT; #s_log("H_PLL_SUBMIT: $H_PLL_SUBMIT"); if(!empty($H_PLL_SUBMIT)) h_poll_submit_votes($id); $galleta=h_poll_set_cookie($id, __H_POLL_KEY); #s_log("galleta: $galleta"); return h_poll_get_table($id, $galleta, $template_name); } function h_poll_submit_votes($id) { $galleta=h_poll_get_cookie(__H_POLL_KEY); $span=__H_POLL_KEY+__H_POLL_SPAN; $comment=h_poll_get_comment(); hopp_db_start_transaction($id); if(!empty($comment)) h_poll_put_comment($id, $galleta, __H_POLL_KEY, $comment); for($i=__H_POLL_KEY;$i<$span;$i++) { h_poll_put_votes($id, $galleta, $i); } hopp_db_end_transaction($id); } function h_poll_get_table($id, $galleta, $template_name="poll") { //global $galleta, $ENVIAR; #s_log("cookie: $galleta"); if(h_poll_used_cookie($id, $galleta)) { #s_log("Used cookie: $galleta"); if(__H_POLL_SPAN>1) return h_poll_get_processed_table($id, $galleta, __H_POLL_KEY, __H_POLL_SPAN, $template_name); else if (__H_POLL_SHOW_RESULTS) return h_poll_get_results($id, $template_name); else return; } else return h_poll_get_cached_table($id, $galleta, $template_name); } function h_poll_get_results($id, $template_name) { global $SERVER_NAME; $doc_id_string="$SERVER_NAME:$template_name:POLL-RESULT:$POLL"; #s_log("doc_id_string: $doc_id_string"); $doc_include=hopp_get_local_doc_array_from_cache($doc_id_string , __H_POLL_RESULTS_CACHE_TTL); if(empty($doc_include)) { $doc_include=h_poll_get_processed_results($id, __H_POLL_KEY, __H_POLL_SPAN, $template_name); $doc_put=hopp_put_local_doc_array_into_cache($doc_id_string, $doc_include); } return $doc_include; } #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ } //__HOPP_GLUE ?>