diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index b8d31fd46..678b770dd 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -1027,7 +1027,7 @@ function update_706_to_800($type='') { //else if the menu is not active //we need to delete the online_extended menu row, and change the online_menu to online $sql->delete('menus', " menu_path='online_extended_menu' || menu_path='online_extended_menu/' "); - $log->logMessage(LAN_UPDATE_31, E_MESSAGE_DEBUG); + $log->logMessage(LAN_UPDATE_23, E_MESSAGE_DEBUG); } catch_error($sql); } diff --git a/e107_core/bbcodes/bb_img.php b/e107_core/bbcodes/bb_img.php index 5450ccb96..c745c2e88 100644 --- a/e107_core/bbcodes/bb_img.php +++ b/e107_core/bbcodes/bb_img.php @@ -274,12 +274,12 @@ switch($pref['image_post_disabled_method']) { case '1' : - return CORE_LAN17; + return defset('CORE_LAN17'); case '2' : return ''; } - return CORE_LAN18 . $code_text; + return defset('CORE_LAN18') . $code_text; } diff --git a/e107_plugins/poll/admin_config.php b/e107_plugins/poll/admin_config.php index 476a45468..eb7c683df 100644 --- a/e107_plugins/poll/admin_config.php +++ b/e107_plugins/poll/admin_config.php @@ -53,7 +53,7 @@ if (isset($_POST['submit'])) { if($_POST['poll_title']) { - define("POLLID",$_POST['poll_id']); + define("POLLID", (int) $_POST['poll_id']); $poll->submit_poll(); $mes->addSuccess(LAN_CREATED); unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']); diff --git a/e107_plugins/poll/poll_class.php b/e107_plugins/poll/poll_class.php index 9e732174e..1d082afee 100644 --- a/e107_plugins/poll/poll_class.php +++ b/e107_plugins/poll/poll_class.php @@ -117,11 +117,11 @@ class poll */ function submit_poll($mode=1) { - global $admin_log; - $tp = e107::getParser(); $sql = e107::getDb(); - + $admin_log = e107::getLog(); + + $pollID = (int) varset($_POST['poll_id']); $poll_title = $tp->toDB($_POST['poll_title']); $poll_comment = $tp->toDB($_POST['poll_comment']); $multipleChoice = intval($_POST['multipleChoice']); @@ -134,13 +134,13 @@ class poll $pollOption = $tp->filter($_POST['poll_option']); $pollOption = array_filter($pollOption, 'poll::clean_poll_array'); - + foreach ($pollOption as $key => $value) { $poll_options .= $tp->toDB($value).chr(1); } - if (POLLACTION == 'edit' || vartrue($_POST['poll_id'])) + if (defset('POLLACTION') === 'edit' || !empty($pollID)) { $sql->update("polls", "poll_title='{$poll_title}', poll_options='{$poll_options}', @@ -150,15 +150,15 @@ class poll poll_result_type={$showResults}, poll_vote_userclass={$pollUserclass}, poll_storage_method={$storageMethod} - WHERE poll_id=".intval(POLLID)); + WHERE poll_id=".$pollID); /* update poll results - bugtracker #1124 .... */ - $sql->select("polls", "poll_votes", "poll_id='".intval(POLLID)."' "); + $sql->select("polls", "poll_votes", "poll_id='".$pollID."' "); $foo = $sql->fetch(); $voteA = explode(chr(1), $foo['poll_votes']); - $poll_option = varset($poll_option, 0); - $opt = count($poll_option) - count($voteA); + // $poll_option = varset($poll_options, 0); + $opt = count($pollOption) - count($voteA); if ($opt) { @@ -166,10 +166,10 @@ class poll { $foo['poll_votes'] .= '0'.chr(1); } - $sql->update("polls", "poll_votes='".$foo['poll_votes']."' WHERE poll_id='".intval(POLLID)."' "); + $sql->update("polls", "poll_votes='".$foo['poll_votes']."' WHERE poll_id='".$pollID."' "); } - e107::getLog()->add('POLL_02','ID: '.POLLID.' - '.$poll_title,''); + e107::getLog()->add('POLL_02','ID: '.$pollID.' - '.$poll_title,''); //$message = POLLAN_45; } else @@ -871,7 +871,7 @@ class poll // $text .= " "; $text .= $frm->admin_button('preview',LAN_PREVIEW,'other'); - if (POLLACTION == 'edit') + if (defset('POLLACTION') === 'edit') { $text .= $frm->admin_button('submit', LAN_UPDATE, 'update')." @@ -918,6 +918,7 @@ class poll_shortcodes extends e_shortcode public $pollPercentage = 0; public $pollVotes = 0; public $pollCount = 0; // total polls in the system + public $pollType; private $barl = null; private $barr = null; diff --git a/e107_tests/tests/unit/e_formTest.php b/e107_tests/tests/unit/e_formTest.php index a2d3a344d..7547b79ca 100644 --- a/e107_tests/tests/unit/e_formTest.php +++ b/e107_tests/tests/unit/e_formTest.php @@ -855,12 +855,15 @@ class e_formTest extends \Codeception\Test\Unit { } - +*/ public function testAdmin_button() { + $result = $this->_frm->admin_button('update_id', "Update", 'update'); + $expected = ""; + $this->assertSame($expected, $result); } - +/* public function testDefaultButtonClassExists() {