1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Issue #3216 PHP7 Fixes.

This commit is contained in:
Cameron 2019-01-17 13:20:56 -08:00
parent 68a4aaea16
commit 221f12088b
5 changed files with 73 additions and 63 deletions

View File

@ -45,7 +45,7 @@ if(e_AJAX_REQUEST) // TODO improve security
{
$clean_type = preg_replace("/[^\w\d]/","",$_GET['type']);
$tmp = e107::getComment()->getComments($clean_type,intval($_GET['id']),intval($_GET['from']),$att);
$tmp = e107::getComment()->getComments($clean_type,intval($_GET['id']),intval($_GET['from']));
echo $tmp['comments'];
exit;
}
@ -196,21 +196,21 @@ if (isset($_POST['commentsubmit']) || isset($_POST['editsubmit']))
switch ($table)
{
case 'poll' :
if (!$sql->db_Select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1"))
if (!$sql->select("polls", "poll_title", "`poll_id` = '{$id}' AND `poll_comment` = 1"))
{
e107::redirect();
exit;
}
break;
case 'news' :
if (!$sql->db_Select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0"))
if (!$sql->select("news", "news_allow_comments", "`news_id` = '{$id}' AND `news_allow_comments` = 0"))
{
e107::redirect();
exit;
}
break;
case 'user' :
if (!$sql->db_Select('user', 'user_name', '`user_id` ='.$id))
if (!$sql->select('user', 'user_name', '`user_id` ='.$id))
{
e107::redirect();
exit;
@ -323,9 +323,9 @@ if ($action == "reply")
$query = "`comment_id` = '{$id}' LIMIT 0,1";
if ($sql->db_Select("comments", "comment_subject", "`comment_id` = '{$id}'"))
if ($sql->select("comments", "comment_subject", "`comment_id` = '{$id}'"))
{
$comments = $sql->db_Fetch();
$comments = $sql->fetch();
$subject = $comments['comment_subject'];
$subject_header = $tp->toHTML($comments['comment_subject']);
}
@ -335,35 +335,35 @@ if ($action == "reply")
switch ($table)
{
case 'news' :
if (!$sql->db_Select("news", "news_title", "news_id='{$nid}' "))
if (!$sql->select("news", "news_title", "news_id='{$nid}' "))
{
e107::redirect();
exit;
}
else
{
$news = $sql->db_Fetch();
$news = $sql->fetch();
$subject = $news['news_title'];
$title = COMLAN_100;
}
break;
case 'poll' :
if (!$sql->db_Select("polls", "poll_title", "poll_id='{$nid}' "))
if (!$sql->select("polls", "poll_title", "poll_id='{$nid}' "))
{
e107::redirect();
exit;
}
else
{
$poll = $sql->db_Fetch();
$poll = $sql->fetch();
$subject = $poll['poll_title'];
$title = COMLAN_101;
}
break;
case 'download' :
if ($sql->db_Select('download','download_name',"download_id={$nid} "))
if ($sql->select('download','download_name',"download_id={$nid} "))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$subject = $row['download_name'];
$title = COMLAN_106;
}
@ -374,9 +374,9 @@ if ($action == "reply")
}
break;
case 'user' :
if ($sql->db_Select('user','user_name',"user_id={$nid} "))
if ($sql->select('user','user_name',"user_id={$nid} "))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$subject = $row['user_name'];
$title = COMLAN_12;
}
@ -435,7 +435,7 @@ elseif ($action == 'comment')
}
else
{
$news = $sql->db_Fetch();
$news = $sql->fetch();
$subject = $tp->toForm($news['news_title']);
define("e_PAGETITLE", "{$subject} - ".COMLAN_100." / ".LAN_COMMENTS);
require_once(HEADERF);
@ -447,14 +447,14 @@ elseif ($action == 'comment')
}
break;
case 'poll' :
if (!$sql->db_Select("polls", "*", "poll_id='{$id}'"))
if (!$sql->select("polls", "*", "poll_id='{$id}'"))
{
e107::redirect();
exit;
}
else
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$comments_poll = $row['poll_comment'];
$subject = $row['poll_title'];
define("e_PAGETITLE", $subject.' - '.COMLAN_101." / ".LAN_COMMENTS);
@ -470,9 +470,9 @@ elseif ($action == 'comment')
}
break;
case 'download' :
if ($sql->db_Select('download','download_name',"download_id={$id} "))
if ($sql->select('download','download_name',"download_id={$id} "))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$subject = $row['download_name'];
$title = COMLAN_106;
$field = $id;
@ -485,9 +485,9 @@ elseif ($action == 'comment')
}
break;
case 'user' :
if ($sql->db_Select('user','user_name',"user_id={$id} "))
if ($sql->select('user','user_name',"user_id={$id} "))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$subject = $row['user_name'];
//$title = 'Edit comment about user';
$field = $id;
@ -503,9 +503,9 @@ elseif ($action == 'comment')
$e_comment = $cobj->get_e_comment();
if ($table == $e_comment[$table]['eplug_comment_ids'])
{
if ($sql->db_Select($e_comment[$table]['db_table'],$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} "))
if ($sql->select($e_comment[$table]['db_table'],$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} "))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$subject = $row[$e_comment[$table]['db_title']];
$title = $e_comment[$table]['plugin_name'];
$field = $id;
@ -553,7 +553,7 @@ $cobj->compose_comment($table, $action, $field, $width, $subject, $rate=FALSE);
if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == 'news')
{
if($sql->db_Select("trackback", "*", "trackback_pid={$id}"))
if($sql->select("trackback", "*", "trackback_pid={$id}"))
{
$tbArray = $sql -> db_getList();
@ -568,13 +568,15 @@ if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == 'n
$text = "";
foreach($tbArray as $trackback)
foreach($tbArray as $row)
{
extract($trackback);
$TITLE = $trackback_title;
$EXCERPT = $trackback_excerpt;
$BLOGNAME = "<a href='{$trackback_url}' rel='external'>{$trackback_blogname}</a>";
$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TRACKBACK);
$scArray = array(
'TITLE' => $row['trackback_title'],
'EXCERPT' => $row['trackback_excerpt'],
'BLOGNAME' => "<a href='{$row['trackback_url']}' rel='external'>{$row['trackback_blogname']}</a>"
);
$text .= $tp->parseTemplate($TRACKBACK, false, $scArray);
}
if($TRACKBACK_RENDER_METHOD)
@ -607,4 +609,3 @@ if ($comment_ob_start)
}
require_once(FOOTERF);
?>

View File

@ -926,8 +926,8 @@ class comment
/**
* Enter description here...
*
* @param unknown_type $table
* @return unknown
* @param string $table
* @return string|int
*/
function getCommentType($table)
{

View File

@ -42,9 +42,14 @@ if(e_QUERY)
exit;
}
if (!$BANNER_LOGIN_TABLE)
if (empty($BANNER_LOGIN_TABLE) || empty($BANNER_TABLE) || empty($BANNER_TABLE_START) || empty($BANNER_TABLE_END))
{
if(file_exists(THEME.'templates/banner/banner_template.php')) // v2.x location.
$BANNER_TABLE_START = '';
$BANNER_TABLE_END = '';
$BANNER_TABLE = '';
$BANNER_LOGIN_TABLE = '';
if(file_exists(THEME.'templates/banner/banner_template.php')) // v2.x location.
{
require_once (THEME.'templates/banner/banner_template.php');
}
@ -93,35 +98,36 @@ if (isset($_POST['clientsubmit']))
{
$start_date = ($row['banner_startdate'] ? strftime("%d %B %Y", $row['banner_startdate']) : BANNERLAN_31);
$end_date = ($row['banner_enddate'] ? strftime("%d %B %Y", $row['banner_enddate']) : BANNERLAN_31);
$BANNER_TABLE_CLICKPERCENTAGE = ($row['banner_clicks'] && $row['banner_impressions'] ? round(($row['banner_clicks'] / $row['banner_impressions']) * 100)."%" : "-");
$BANNER_TABLE_IMPRESSIONS_LEFT = ($row['banner_impurchased'] ? $row['banner_impurchased'] - $row['banner_impressions'] : BANNERLAN_30);
$BANNER_TABLE_IMPRESSIONS_PURCHASED = ($row['banner_impurchased'] ? $row['banner_impurchased'] : BANNERLAN_30);
$BANNER_TABLE_CLIENTNAME = $row['banner_clientname'];
$BANNER_TABLE_BANNER_ID = $row['banner_id'];
$BANNER_TABLE_BANNER_CLICKS = $row['banner_clicks'];
$BANNER_TABLE_BANNER_IMPRESSIONS = $row['banner_impressions'];
$BANNER_TABLE_ACTIVE = LAN_VISIBILITY." ".($row['banner_active'] != "255" ? LAN_YES : "<b>".LAN_NO."</b>");
$BANNER_TABLE_STARTDATE = LAN_START." ".$start_date;
$BANNER_TABLE_ENDDATE = LAN_END." ".$end_date;
$scArray = array();
$scArray['BANNER_TABLE_CLICKPERCENTAGE'] = ($row['banner_clicks'] && $row['banner_impressions'] ? round(($row['banner_clicks'] / $row['banner_impressions']) * 100)."%" : "-");
$scArray['BANNER_TABLE_IMPRESSIONS_LEFT'] = ($row['banner_impurchased'] ? $row['banner_impurchased'] - $row['banner_impressions'] : BANNERLAN_30);
$scArray['BANNER_TABLE_IMPRESSIONS_PURCHASED'] = ($row['banner_impurchased'] ? $row['banner_impurchased'] : BANNERLAN_30);
$scArray['BANNER_TABLE_CLIENTNAME'] = $row['banner_clientname'];
$scArray['BANNER_TABLE_BANNER_ID'] = $row['banner_id'];
$scArray['BANNER_TABLE_BANNER_CLICKS'] = $row['banner_clicks'];
$scArray['BANNER_TABLE_BANNER_IMPRESSIONS'] = $row['banner_impressions'];
$scArray['BANNER_TABLE_ACTIVE'] = LAN_VISIBILITY." ".($row['banner_active'] != "255" ? LAN_YES : "<b>".LAN_NO."</b>");
$scArray['BANNER_TABLE_STARTDATE'] = LAN_START." ".$start_date;
$scArray['BANNER_TABLE_ENDDATE'] = LAN_END." ".$end_date;
if ($row['banner_ip'])
{
$tmp = explode("^", $row['banner_ip']);
$BANNER_TABLE_IP_LAN = (count($tmp)-1);
$scArray['BANNER_TABLE_IP_LAN'] = (count($tmp)-1);
for($a = 0; $a <= (count($tmp)-2); $a++) {
$BANNER_TABLE_IP .= $tmp[$a]."<br />";
$scArray['BANNER_TABLE_IP'] .= $tmp[$a]."<br />";
}
}
$textstring .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_TABLE);
$textstring .= $tp->parseTemplate($BANNER_TABLE, true, $scArray);
}
}
$textstart = preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_TABLE_START);
$textend = preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_TABLE_END);
$textstart = $tp->parseTemplate($BANNER_TABLE_START, true, $scArray);
$textend = $tp->parseTemplate($BANNER_TABLE_END, true, $scArray);
$text = $textstart.$textstring.$textend;
$ns->tablerender(PAGE_NAME, $text);
@ -130,15 +136,16 @@ if (isset($_POST['clientsubmit']))
exit;
}
$scArray = array();
$scArray['BANNER_LOGIN_TABLE_LOGIN'] = $frm->text("clientlogin", $id);
$scArray['BANNER_LOGIN_TABLE_PASSW'] = $frm->password("clientpassword", '');
$scArray['BANNER_LOGIN_TABLE_SUBMIT'] = $frm->button("clientsubmit", LAN_CONTINUE, "submit");
$BANNER_LOGIN_TABLE_LOGIN = $frm->text("clientlogin", $id);
$BANNER_LOGIN_TABLE_PASSW = $frm->password("clientpassword", $pw);
$BANNER_LOGIN_TABLE_SUBMIT = $frm->button("clientsubmit", LAN_CONTINUE, "submit");
$text = $tp->parseTemplate($BANNER_LOGIN_TABLE, true, $scArray);
$text = preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_LOGIN_TABLE);
$ns->tablerender(BANNERLAN_19, $text);
require_once(FOOTERF);
?>

View File

@ -55,8 +55,8 @@ $rc->list_pref = $rc->getListPrefs();
//render message if set
if(isset($message))
{
$MESSAGE = $message;
$t = preg_replace("/\{(.*?)\}/e", '$\1', $rc->template['ADMIN_MESSAGE']);
$scArray = array('MESSAGE' => $message);
$t = $tp->parseTemplate($rc->template['ADMIN_MESSAGE'], false, $scArray);
$mes->addInfo($message);
//$rc->e107->ns->tablerender('', $t);
}
@ -73,7 +73,7 @@ e107::getRender()->tablerender(LAN_PLUGIN_LIST_NEW_NAME, $mes->render(). $text);
*/
function admin_list_config_adminmenu()
{
$act = "";
unset($var);
$var=array();
//$var['general']['text'] = LIST_ADMIN_OPT_1;
@ -82,8 +82,10 @@ function admin_list_config_adminmenu()
$var['list-new-new-page']['text'] = LIST_ADMIN_OPT_4;
$var['list-new-new-menu']['text'] = LIST_ADMIN_OPT_5;
e107::getNav()->admin(LAN_OPTIONS.'--id--list_new', 'list-new-recent-page', $var);
return null;
}
require_once(e_ADMIN."footer.php");
?>

View File

@ -1170,7 +1170,7 @@ $text .= "</div>";*/
//print_a($search_prefs);
//$
$text .= $SEARCH_MESSAGE ? preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TABLE_MSG) : "";
// $text .= $SEARCH_MESSAGE ? preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_TABLE_MSG) : "";
$text .= $SEARCH_VARS->SEARCH_MESSAGE ? $tp->simpleParse($SEARCH_TABLE_MSG, $SEARCH_VARS) : "";
//$text .= preg_replace("/\{(.*?)\}/e", '$\1', $SEARCH_BOT_TABLE);
$text .= $tp->simpleParse($SEARCH_BOT_TABLE, $SEARCH_VARS);