1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Issue #4299 - PHP8 fatal error fixes

This commit is contained in:
Cameron
2021-10-17 08:43:07 -07:00
parent 8d968d2ee3
commit 73dfbf0d74
5 changed files with 22 additions and 18 deletions

View File

@@ -1027,7 +1027,7 @@ function update_706_to_800($type='')
{ //else if the menu is not active { //else if the menu is not active
//we need to delete the online_extended menu row, and change the online_menu to online //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/' "); $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); catch_error($sql);
} }

View File

@@ -274,12 +274,12 @@
switch($pref['image_post_disabled_method']) switch($pref['image_post_disabled_method'])
{ {
case '1' : case '1' :
return CORE_LAN17; return defset('CORE_LAN17');
case '2' : case '2' :
return ''; return '';
} }
return CORE_LAN18 . $code_text; return defset('CORE_LAN18') . $code_text;
} }

View File

@@ -53,7 +53,7 @@ if (isset($_POST['submit']))
{ {
if($_POST['poll_title']) if($_POST['poll_title'])
{ {
define("POLLID",$_POST['poll_id']); define("POLLID", (int) $_POST['poll_id']);
$poll->submit_poll(); $poll->submit_poll();
$mes->addSuccess(LAN_CREATED); $mes->addSuccess(LAN_CREATED);
unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']); unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']);

View File

@@ -117,11 +117,11 @@ class poll
*/ */
function submit_poll($mode=1) function submit_poll($mode=1)
{ {
global $admin_log;
$tp = e107::getParser(); $tp = e107::getParser();
$sql = e107::getDb(); $sql = e107::getDb();
$admin_log = e107::getLog();
$pollID = (int) varset($_POST['poll_id']);
$poll_title = $tp->toDB($_POST['poll_title']); $poll_title = $tp->toDB($_POST['poll_title']);
$poll_comment = $tp->toDB($_POST['poll_comment']); $poll_comment = $tp->toDB($_POST['poll_comment']);
$multipleChoice = intval($_POST['multipleChoice']); $multipleChoice = intval($_POST['multipleChoice']);
@@ -140,7 +140,7 @@ class poll
$poll_options .= $tp->toDB($value).chr(1); $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}', $sql->update("polls", "poll_title='{$poll_title}',
poll_options='{$poll_options}', poll_options='{$poll_options}',
@@ -150,15 +150,15 @@ class poll
poll_result_type={$showResults}, poll_result_type={$showResults},
poll_vote_userclass={$pollUserclass}, poll_vote_userclass={$pollUserclass},
poll_storage_method={$storageMethod} poll_storage_method={$storageMethod}
WHERE poll_id=".intval(POLLID)); WHERE poll_id=".$pollID);
/* update poll results - bugtracker #1124 .... */ /* 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(); $foo = $sql->fetch();
$voteA = explode(chr(1), $foo['poll_votes']); $voteA = explode(chr(1), $foo['poll_votes']);
$poll_option = varset($poll_option, 0); // $poll_option = varset($poll_options, 0);
$opt = count($poll_option) - count($voteA); $opt = count($pollOption) - count($voteA);
if ($opt) if ($opt)
{ {
@@ -166,10 +166,10 @@ class poll
{ {
$foo['poll_votes'] .= '0'.chr(1); $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; //$message = POLLAN_45;
} }
else else
@@ -871,7 +871,7 @@ class poll
// $text .= "<input type='submit' name='preview' value='".LAN_PREVIEW."' /> "; // $text .= "<input type='submit' name='preview' value='".LAN_PREVIEW."' /> ";
$text .= $frm->admin_button('preview',LAN_PREVIEW,'other'); $text .= $frm->admin_button('preview',LAN_PREVIEW,'other');
if (POLLACTION == 'edit') if (defset('POLLACTION') === 'edit')
{ {
$text .= $frm->admin_button('submit', LAN_UPDATE, 'update')." $text .= $frm->admin_button('submit', LAN_UPDATE, 'update')."
@@ -918,6 +918,7 @@ class poll_shortcodes extends e_shortcode
public $pollPercentage = 0; public $pollPercentage = 0;
public $pollVotes = 0; public $pollVotes = 0;
public $pollCount = 0; // total polls in the system public $pollCount = 0; // total polls in the system
public $pollType;
private $barl = null; private $barl = null;
private $barr = null; private $barr = null;

View File

@@ -855,12 +855,15 @@ class e_formTest extends \Codeception\Test\Unit
{ {
} }
*/
public function testAdmin_button() public function testAdmin_button()
{ {
$result = $this->_frm->admin_button('update_id', "Update", 'update');
$expected = "<button data-loading-icon='fa-spinner' type='submit' name='update_id' value='Update' id='update-id' class='btn update btn-success'><span>Update</span></button>";
$this->assertSame($expected, $result);
} }
/*
public function testDefaultButtonClassExists() public function testDefaultButtonClassExists()
{ {