diff --git a/e107_plugins/poll/admin_config.php b/e107_plugins/poll/admin_config.php index f1d5d2709..1050dd778 100644 --- a/e107_plugins/poll/admin_config.php +++ b/e107_plugins/poll/admin_config.php @@ -2,16 +2,12 @@ /* * e107 website system * - * Copyright (C) 2008-2009 e107 Inc (e107.org) + * Copyright (C) 2008-2013 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * - * - * $Source: /cvs_backup/e107_0.8/e107_plugins/poll/admin_config.php,v $ - * $Revision$ - * $Date$ - * $Author$ + * $URL$ + * $Id$ */ require_once("../../class2.php"); @@ -27,6 +23,7 @@ include_lan(e_PLUGIN.'poll/languages/'.e_LANGUAGE.'_admin_poll.php'); require_once(e_ADMIN."auth.php"); require_once(e_PLUGIN."poll/poll_class.php"); require_once(e_HANDLER."form_handler.php"); +require_once(e_HANDLER."message_handler.php"); require_once(e_HANDLER."userclass_class.php"); if(isset($_POST)) @@ -36,6 +33,8 @@ if(isset($_POST)) $rs = new form; $poll = new poll; +$frm = e107::getForm(); +$mes = e107::getMessage(); if (isset($_POST['reset'])) { @@ -43,12 +42,13 @@ if (isset($_POST['reset'])) define("RESET", TRUE); } - - $emessage = eMessage::getInstance(); +//$emessage = eMessage::getInstance(); if (varset($_POST['delete'])) { - $message = $poll->delete_poll(key($_POST['delete'])); + //$message = $poll->delete_poll(key($_POST['delete'])); + $poll->delete_poll(key($_POST['delete'])); // TODO check security? + $mes->addSuccess(LAN_DELETED); unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']); $_GET['mode']='list'; } @@ -59,12 +59,15 @@ if (isset($_POST['submit'])) if($_POST['poll_title']) { define("POLLID",$_POST['poll_id']); - $emessage->add($poll -> submit_poll(), E_MESSAGE_SUCCESS); + //$emessage->add($poll -> submit_poll(), E_MESSAGE_SUCCESS); + $poll -> submit_poll(); + $mes->addSuccess(LAN_CREATED); unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']); } else { - $emessage->add(POLLAN_46, E_MESSAGE_SUCCESS); + //$emessage->add(POLLAN_46, E_MESSAGE_SUCCESS); + $mes->addError(LAN_REQUIRED_BLANK); } $_GET['mode']='list'; @@ -88,16 +91,17 @@ if (varset($_POST['edit']) || varset($_GET['mode'])=='create' && !varset($_POST[ $poll_total = $sql->db_Select("polls"); $text = $poll -> renderPollForm(); - $ns->tablerender(POLLAN_MENU_CAPTION." :: ".POLLAN_2, $text); + $ns->tablerender(POLLAN_MENU_CAPTION." - ".POLLAN_2, $mes->render() . $text); } - +/* if (isset($message)) { $emessage->add($message, E_MESSAGE_SUCCESS); } +*/ if(!varset($_POST['edit']) && ($_GET['mode']=="list" || !$_GET['mode'])) { @@ -159,8 +163,8 @@ function poll_list() $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); - $frm = new e_form(true); - + $frm = e107::getForm(); + $mes = e107::getMessage(); global $user_pref; if(isset($_POST['etrigger_ecolumns'])) //TODO User @@ -173,7 +177,7 @@ function poll_list() //TODO Add more column options. $fields = array( - 'poll_id' => array('title'=> ID, 'width'=>'5%', 'forced'=> TRUE), + 'poll_id' => array('title'=> LAN_ID, 'width'=>'5%', 'forced'=> TRUE), 'poll_title' => array('title'=> POLLAN_3, 'width'=>'auto'), 'poll_options' => array('title'=> POLLAN_4, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center' ), // No real vetting // 'poll_start_datestamp' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name @@ -189,7 +193,7 @@ function poll_list() - $text = "
+ $text = "
"; if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) @@ -201,9 +205,10 @@ function poll_list() while ($row = $sql->db_Fetch()) { - extract($row); + extract($row); // FIXME - $text .= " + $text .= " + $poll_id"; $text .= (in_array("poll_title",$fieldpref)) ? "".$tp -> toHTML($poll_title, TRUE,"no_hook, emotes_off, defs")."" : ""; $text .= (in_array("poll_options",$fieldpref)) ? "".(str_replace(chr(1),"
",$poll_options))."" : ""; @@ -215,19 +220,20 @@ function poll_list() toJS(LAN_CONFIRMDEL." [".$poll_id."]")."') \" src='".ADMIN_DELETE_ICON_PATH."' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' /> - "; + "; } $text .= ""; } else { - $text .= "
".POLLAN_7."
"; + //$text .= "
".POLLAN_7."
"; + $mes->addInfo(POLLAN_7); } - $text .= "
"; + $text .= ""; - $emessage = eMessage::getInstance(); + //$emessage = eMessage::getInstance(); - $ns->tablerender(POLLAN_MENU_CAPTION." :: ".POLLAN_1,$emessage->render(). $text); + $ns->tablerender(POLLAN_MENU_CAPTION." - ".POLLAN_1, $mes->render(). $text); } diff --git a/e107_plugins/poll/languages/English_admin_poll.php b/e107_plugins/poll/languages/English_admin_poll.php index a8f2a474b..d82564448 100644 --- a/e107_plugins/poll/languages/English_admin_poll.php +++ b/e107_plugins/poll/languages/English_admin_poll.php @@ -2,16 +2,12 @@ /* * e107 website system * - * Copyright (C) 2008-2009 e107 Inc (e107.org) + * Copyright (C) 2008-2013 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * - * - * $Source: /cvs_backup/e107_0.8/e107_plugins/poll/languages/English_admin_poll.php,v $ - * $Revision$ - * $Date$ - * $Author$ + * $URL$ + * $Id$ */ //define("POLL_ADLAN01", "Poll"); @@ -22,7 +18,7 @@ define("POLL_ADLAN04", "The poll plugin has been successfully installed. To add define("POLL_ADLAN05", "Main Poll: "); define("POLL_ADLAN06", "Forum Thread: "); define("POLL_ADLAN07", "Type"); -define("POLL_ADLAN08", "Poll deleted"); +//define("POLL_ADLAN08", "Poll deleted"); define("POLLAN_MENU_CAPTION", "Poll"); @@ -73,7 +69,7 @@ define("POLLAN_43", "You do not have the required permissions to vote in this po define("POLLAN_44", "Delete this poll?"); */ -define("POLLAN_46", "Field(s) left blank"); +//define("POLLAN_46", "Field(s) left blank"); // Log messages define('LAN_AL_POLL_01','Poll deleted'); diff --git a/e107_plugins/poll/poll_class.php b/e107_plugins/poll/poll_class.php index a913d0cc8..73679f227 100644 --- a/e107_plugins/poll/poll_class.php +++ b/e107_plugins/poll/poll_class.php @@ -2,16 +2,12 @@ /* * e107 website system * - * Copyright (C) 2008-2009 e107 Inc (e107.org) + * Copyright (C) 2008-2013 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * - * - * - * $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_class.php,v $ - * $Revision$ - * $Date$ - * $Author$ + * $URL$ + * $Id$ */ if (!defined('e107_INIT')) { exit; } @@ -67,8 +63,8 @@ class poll { admin_purge_related("poll", $existing); } - $admin_log->log_event('POLL_01',POLL_ADLAN08.': '.$existing,''); - return POLL_ADLAN08; + $admin_log->log_event('POLL_01',LAN_AL_POLL_01.': '.$existing,''); + //return POLL_ADLAN08; } } @@ -126,7 +122,7 @@ class poll } $admin_log->log_event('POLL_02','ID: '.POLLID.' - '.$poll_title,''); - $message = POLLAN_45; + //$message = POLLAN_45; } else { @@ -629,13 +625,13 @@ class poll if (POLLACTION == 'edit') { - $text .= $frm->admin_button('submit',POLLAN_22,'submit')." + $text .= $frm->admin_button('submit', LAN_UPDATE, 'update')." "; } else { - $text .= $frm->admin_button('submit','no-value','submit',POLLAN_23); + $text .= $frm->admin_button('submit','no-value','submit', LAN_CREATE); // $text .= " "; } }