1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

PHP8 Compatibility and code cleanup.

This commit is contained in:
Cameron
2020-12-08 12:21:12 -08:00
parent a094a8fb73
commit afaac88003
49 changed files with 264 additions and 225 deletions

View File

@@ -64,7 +64,10 @@ if(function_exists('utf8_encode') === false)
if(!isset($_E107['cli']))
{
while (@ob_end_clean()); // destroy all ouput buffering
while (ob_get_length() !== false) // destroy all ouput buffering
{
ob_end_clean();
}
ob_start(); // start our own.
$oblev_at_start = ob_get_level(); // preserve when destroying globals in step C
}
@@ -328,7 +331,6 @@ if(!defined('e_SECURITY_LEVEL'))
//$e107->url = e107::getUrl(); - caught by __get()
//TODO - find & replace $e107->url
//DEPRECATED, BC, $e107->tp caught by __get()
/** @var e_parse $tp */
$tp = e107::getParser(); //TODO - find & replace $tp, $e107->tp
//define("e_QUERY", $matches[2]);
@@ -1960,6 +1962,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
break;
}
}
@@ -2747,10 +2750,6 @@ class e_http_header
{
$this->compress_output = (bool) e107::getPref('compress_output', false);
}
else
{
$this->compress_output = false;
}
}

View File

@@ -117,7 +117,7 @@ else
if (e_AJAX_REQUEST)
{
require_once (e_HANDLER.'js_helper.php');
e_jshelper::sendAjaxError(403, ADLAN_86, ADLAN_87, true);
e_jshelper::sendAjaxError(403, ADLAN_86, ADLAN_87);
}
require_once(e_ADMIN.'boot.php');

View File

@@ -72,7 +72,7 @@ if ($error_string = do_export($filename, $type_list, $format_array, $use_separat
banlist_adminlog('06','File: '.$filename.'<br />'.$error_string);
function do_export($filename, $type_list='',$format_array, $sep = ',', $quot = '"')
function do_export($filename, $type_list='',$format_array=array(), $sep = ',', $quot = '"')
{
$sql = e107::getDb();
$export_text = '';

View File

@@ -2760,7 +2760,7 @@ class media_admin_ui extends e_admin_ui
$count = 0;
$prevType = '';
while (list($key, $image_name) = each($dirlist))
foreach($dirlist as $key=>$image_name)
{
//$users = IMALAN_21." | ";
$row = array('user_id' => '');

View File

@@ -15,21 +15,22 @@ if (!defined('e107_INIT')) { exit; }
$mes = e107::getMessage();
$buts = "";
$newarray = e107::getNav()->adminLinks('core');
while (list($key, $funcinfo) = each($newarray))
$newarray = e107::getNav()->adminLinks('core');
foreach($newarray as $key=>$funcinfo)
{
$buts .= e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis");
}
if($buts != "")
if(!empty($buts))
{
$text = "<div style='text-align:center'>
<table class='table'>";
$text .= $buts;
$text .= render_clean();
$text .= "</table></div>";
$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
e107::getRender()->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
}
$text = "<div style='text-align:center'>
<table class='table'>";
@@ -39,6 +40,6 @@ $text .= render_clean();
$text .= "</table></div>";
$ns->tablerender(ADLAN_CL_7, $text,'infopanel');
e107::getRender()->tablerender(ADLAN_CL_7, $text,'infopanel');
?>

View File

@@ -19,7 +19,8 @@ $newarray = e107::getNav()->adminLinks('core');
$text = "<div style='text-align:center'>
<table class='table'>";
$buts = "";
while (list($key, $funcinfo) = each($newarray)) {
foreach($newarray as $key=>$funcinfo)
{
$buts .= e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
}
$text .= $buts;
@@ -29,8 +30,9 @@ while ($td <= 5) {
}
$td = 1;
$text .= "</tr></table></div>";
if($buts != ""){
$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
if(!empty($buts))
{
e107::getRender()->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
}
$text = "<div style='text-align:center'>

View File

@@ -21,26 +21,28 @@ $newarray = e107::getNav()->adminLinks('core');
$buts = "";
$text = "<div style='text-align:center'>
<table class='table'>";
while (list($key, $funcinfo) = each($newarray))
foreach($newarray as $key=>$funcinfo)
{
$buts .= e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default');
}
$text .= $buts;
$text_cat = '';
$td = 0;
while ($td <= 5)
{
$text_cat .= "<td class='td' style='width:20%;' ></td>";
$td++;
}
$td = 1;
$text .= "</tr></table></div>";
if($buts !="")
if(!empty($buts))
{
$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
e107::getRender()->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text);
}
$text = "<div style='text-align:center'>
@@ -53,8 +55,7 @@ $text .= e107::getNav()->pluginLinks( E_16_PLUGMANAGER, 'default');
$text .= "</tr>
</table></div>";
$ns->tablerender(ADLAN_CL_7, $text);
e107::getRender()->tablerender(ADLAN_CL_7, $text);
echo admin_info();
?>

View File

@@ -466,7 +466,7 @@ class users_admin_ui extends e_admin_ui
}
public function afterDelete($deletedData, $id=null, $deleted_check)
public function afterDelete($deletedData, $id, $deleted_check)
{
if(!empty($id))
{

View File

@@ -2455,21 +2455,3 @@ class users_ext
}
}// end class
function users_extended_adminmenu() {
global $user, $action, $ns, $curtype, $action;
// $user->show_options($action);
$ac = e_QUERY;
$action = vartrue($ac,'main');
users_ext::show_options($action);
if($action == 'editext' || $action == 'continue')
{
$ns->tablerender(EXTLAN_46." - <span id='ue_type'>&nbsp;</span>", "<div id='ue_help'>&nbsp;</div>");
echo "<script type='text/javascript'>changeHelp('{$curtype}');</script>";
}
}
?>

View File

@@ -174,9 +174,9 @@ class bb_youtube extends e_bb_base
$yID = preg_replace('/[^0-9a-z]/i', '', $picRef);
if (($yID != $picRef) || (strlen($yID) > 20))
{ // Possible hack attempt
}
//if (($yID != $picRef) || (strlen($yID) > 20))
// { // Possible hack attempt
// }
// $params = array_merge($params, $bbpars); // Any parameters set in bbcode override those in HTML
// Could check for valid array indices here
$paramString = implode('&', $params);

View File

@@ -1297,10 +1297,10 @@ class admin_shortcodes
}
$text .= "</ul>";
if($parm == 'list')
{
// if($parm == 'list')
// {
// $text = str_replace("<div style='padding-bottom: 2px;'>","<li>",$text);;
}
// }
// $text .= "\n\t\t\t\t\t</div>";
@@ -1764,10 +1764,10 @@ Inverse 10 <span class="badge badge-inverse">10</span>
{
$plug_vars = $plug->plug_vars;
if($row['plugin_path']=='calendar_menu')
{
// if($row['plugin_path']=='calendar_menu')
// {
// print_a($plug_vars);
}
// }
// moved to boot.php
// e107::loadLanFiles($row['plugin_path'], 'admin');
@@ -1891,10 +1891,10 @@ Inverse 10 <span class="badge badge-inverse">10</span>
// ------------------------------------------------------------------
//added option to disable leave/logout (ll) - more flexibility for theme developers
if(!vartrue($parms['disable_ll']))
{
// if(!vartrue($parms['disable_ll']))
// {
// $menu_vars += $this->getOtherNav('home');
}
// }
// print_a($menu_vars);

View File

@@ -239,10 +239,10 @@ class usersettings_shortcodes extends e_shortcode
foreach ($ucList as $cid)
{
if (check_class($cid, $this->var['user_class'])) $is_checked[$cid] = $cid;
if(isset($_POST['class']))
{
// if(isset($_POST['class']))
// {
// $is_checked[$cid] = in_array($cid, $_POST['class']);
}
// }
}
$inclass = implode(',',$is_checked);

View File

@@ -128,7 +128,7 @@ class sitelinks_alt
return $text;
}
static function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params, $cat_open = FALSE)
static function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params=array(), $cat_open = FALSE)
{
$tp = e107::getParser();

View File

@@ -214,7 +214,7 @@ class e_admin_request
* If $key is array, $value is not used.
* If $value is null, (string) $key is unset
*
* @param object $key
* @param string $key
* @param object $value [optional]
* @return e_admin_request
*/
@@ -1721,7 +1721,7 @@ class e_admin_controller
/**
* Constructor
* @param e_admin_request $request [optional]
* @param e_admin_request $request
*/
public function __construct($request, $response, $params = array())
{
@@ -6466,9 +6466,9 @@ class e_admin_ui extends e_admin_controller_ui
/**
* Set read and write parms with drop-down-list array data (ie. type='dropdown')
* @param str $field
* @param string $field
* @param array $array [optional]
* @return none
* @return null
*/
public function setDropDown($field,$array) //TODO Have Miro check this.
{

View File

@@ -1297,7 +1297,7 @@ class banlistManager
/**
* Return an array of valid ban types (for use as indices into array, generally)
*/
public function getValidReasonList()
public static function getValidReasonList()
{
return array(
eIPHandler::BAN_TYPE_LEGACY,

View File

@@ -328,7 +328,7 @@ class e_jshelper
* @param string $errextended
* @access public
*/
function sendAjaxError($errcode, $errmessage, $errextended = '')
static function sendAjaxError($errcode, $errmessage, $errextended = '')
{
header('Content-type: text/html; charset='.CHARSET, true);
header("HTTP/1.0 {$errcode} {$errmessage}", true);
@@ -337,7 +337,10 @@ class e_jshelper
//Safari expects some kind of output, even empty
echo ($errextended ? $errextended : ' ');
while (@ob_end_flush());
while (ob_get_length() !== false)
{
ob_end_clean();
}
exit;
}

View File

@@ -3921,7 +3921,7 @@ class e107plugin
case 'install':
case 'upgrade':
$ret = $config->add($key, $value);
if($ret->data_has_changed == TRUE)
if($ret->isModified())
{
$mes->addSuccess(EPL_ADLAN_241, $key);
}

View File

@@ -158,7 +158,7 @@ class receiveMail
if ($enc == 4)
$message = quoted_printable_decode($message);
if ($enc == 5)
$message = $message;
// $message = $message;
$fp=fopen($path.$name,"w");
fwrite($fp,$message);
fclose($fp);

View File

@@ -176,7 +176,7 @@ class e107_traffic
{
return;
}
if ($tObject != $this)
if ($tObject !== $this)
{
message_handler("CRITICAL_ERROR", "Bad traffic object", __LINE__ - 2, __FILE__);
}
@@ -225,8 +225,10 @@ if (!isset($qTimeOn))
{
$GLOBALS['qTimeOn'] = explode(' ', microtime());
}
function eQTimeOff()
{
global $qTimeOn;
$e = explode(' ', microtime());
$diff = ((float) $e[0] + (float) $e[1]) - ((float) $qTimeOn[0] + (float) $qTimeOn[1]);
$GLOBALS['qTimeTotal'] += $diff;

View File

@@ -40,7 +40,7 @@ class parseXml extends xmlClass // BC with v1.x
{
// $data = $this->getRemoteFile($address, $timeout);
$fl = e107::getFile();
$data = $fl->getRemoteContent($address);
$data = $fl->getRemoteContent($address, ['timeout' => $timeout]);
$this->xmlLegacyContents = $data;
@@ -227,9 +227,9 @@ class xmlClass
public $errors;
private $arrayTags = false;
private $arrayTags;
private $stringTags = false;
private $stringTags;
private $urlPrefix = false;

View File

@@ -177,10 +177,10 @@ if(!class_exists("_blank_setup"))
$legacyMenuPref = e107::getConfig('menu')->getPref();
if(isset($legacyMenuPref['newforumposts_caption']))
/* if(isset($legacyMenuPref['newforumposts_caption']))
{
}
}*/
return false;
}

View File

@@ -96,12 +96,12 @@ class _blank_admin implements e_admin_addon_interface
if(!empty($id) )
{
if(!empty($data['x__blank_url']))
{
// if(!empty($data['x__blank_url']))
// {
// eg. Save the data in 'blank' plugin table. .
}
// }
}

View File

@@ -43,10 +43,10 @@ class _blank_related // include plugin-folder in the name.
return $items;
}
elseif(ADMIN)
{
// elseif(ADMIN)
// {
// return array(array('title'=>$query,'url'=>''));
}
// }
}
}

View File

@@ -315,10 +315,10 @@ class ExtendedPasswordHandler extends UserHandler
{
$hash = $stored_hash;
}
if(strlen($hash) !== 32)
{
// if(strlen($hash) !== 32)
// {
//return PASSWORD_INVALID;
}
// }
$pwHash = $salt ? md5($salt.$pword) : md5($pword);
$stored_hash = $hash;

View File

@@ -274,10 +274,10 @@ class auth_login extends alt_auth_base
return AUTH_NOUSER; // Bit debateable what to return if this happens
}
}
else // Probably a bit strange if we don't get any info back - but possible
{
//else // Probably a bit strange if we don't get any info back - but possible
// {
// echo "No results!<br />";
}
// }
return AUTH_SUCCESS;
}

View File

@@ -93,9 +93,9 @@ if (strstr(e_QUERY, "fs")) {
}
// end search
if (e_QUERY ? $from = intval(e_QUERY) : $from = 0) {
;
}
//if (e_QUERY ? $from = intval(e_QUERY) : $from = 0) {
//}
$chat_total = $sql->count('chatbox');

View File

@@ -36,9 +36,12 @@ $emessage = '';
if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== '') {
if ( ! USER && ! $pref['anon_post']) {
if ( ! USER && ! $pref['anon_post'])
{
// disallow post
} else {
}
else
{
$nick = trim(preg_replace("#\[.*\]#si", "", $tp->toDB($_POST['nick'])));
$cmessage = $_POST['cmessage'];

View File

@@ -23,12 +23,13 @@ e107::includeLan(e_PLUGIN.'clock_menu/languages/admin/'.e_LANGUAGE.'.php');
$frm = e107::getForm();
$mes = e107::getMessage();
$menu_pref = e107::getConfig('menu')->getPref('');
$menu_pref = e107::getConfig('menu')->getPref();
if (isset($_POST['update_menu']))
{
$temp = array();
while (list($key, $value) = each($_POST))
foreach($_POST as $key=>$value)
{
if ($key != 'update_menu')
{
@@ -39,7 +40,7 @@ if (isset($_POST['update_menu']))
{
$temp['clock_format'] = 0;
}
if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_05'))
if (e107::getLog()->logArrayDiffs($temp,$menu_pref,'MISC_05'))
{
$menuPref = e107::getConfig('menu');
foreach ($temp as $k => $v)
@@ -50,7 +51,7 @@ if (isset($_POST['update_menu']))
}
}
$ns->tablerender($caption, $mes->render(). $text);
e107::getRender()->tablerender(null, $mes->render());
$text = "
<form method='post' action='".e_SELF."?".e_QUERY."' name='menu_conf_form'>
@@ -101,5 +102,5 @@ $text = "
</form>
";
$ns->tablerender(CLOCK_AD_L4, $text);
e107::getRender()->tablerender(CLOCK_AD_L4, $text);
require_once(e_ADMIN."footer.php");

View File

@@ -37,7 +37,7 @@ if (isset($_POST['update_menu']))
$tp = e107::getParser();
while (list($key, $value) = each($_POST))
foreach($_POST as $key=>$value)
{
if($key == "comment_caption")
{
@@ -61,7 +61,7 @@ if (isset($_POST['update_menu']))
if($menu_config->save(false))
{
$mes->addSuccess();
$mes->addSuccess(LAN_SAVED);
}
/*if ($admin_log->logArrayDiffs($old, $menu_config->getPref(), 'MISC_04'))
{
@@ -117,6 +117,6 @@ $text = "
</div>
</form>";
$ns->tablerender(CM_L8, $mes->render() . $text);
e107::getRender()->tablerender(CM_L8, $mes->render() . $text);
require_once(e_ADMIN."footer.php");

View File

@@ -11,7 +11,9 @@ e107::lan('download','download');
$log = e107::getAdminLog();
$id = FALSE;
$sql = e107::getDb();
$tp = e107::getRender();
$pref = e107::pref('core');
if (!is_numeric(e_QUERY) && empty($_GET['id']))
{
@@ -46,13 +48,13 @@ if(strstr(e_QUERY, "mirror"))
{
$row = $sql->fetch();
extract($row);
if (check_class($download_category_class) && check_class($download_class))
if (check_class($row['download_category_class']) && check_class($row['download_class']))
{
if($pref['download_limits'] && $download_active == 1)
if($pref['download_limits'] && $row['download_active'] == 1)
{
check_download_limits();
}
$mirrorList = explode(chr(1), $download_mirror);
$mirrorList = explode(chr(1), $row['download_mirror']);
$mstr = "";
foreach($mirrorList as $mirror)
{
@@ -124,7 +126,7 @@ if (preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY))
$log->addError("Line".__LINE__.": Couldn't find ".e_DOWNLOAD.e_QUERY);
$log->toFile('download_requests','Download Requests', true); // Create a log file and add the log messages
require_once(HEADERF);
$ns->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."\n<br /><br />\n<a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."\n<br /><br />\n<a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
require_once(FOOTERF);
exit();
}
@@ -146,7 +148,7 @@ if ($type == "file")
$search = array("[","]");
$replace = array("<a href='".e_HTTP."download.php'>", "</a>");
$ns->tablerender(LAN_ERROR, "<div class='alert alert-warning' style='text-align:center'>".str_replace($search, $replace, LAN_dl_78).'</div>');
e107::getRender()->tablerender(LAN_ERROR, "<div class='alert alert-warning' style='text-align:center'>".str_replace($search, $replace, LAN_dl_78).'</div>');
require_once(FOOTERF);
exit();
}
@@ -156,9 +158,9 @@ if ($type == "file")
check_download_limits();
}
extract($row);
if($download_mirror)
if($row['download_mirror'])
{
$array = explode(chr(1), $download_mirror);
$array = explode(chr(1), $row['download_mirror']);
$c = (count($array)-1);
for ($i=1; $i < $c; $i++)
{
@@ -199,46 +201,46 @@ if ($type == "file")
$ip = e107::getIPHandler()->getIP(FALSE);
$request_data = "'0', '{$user_id}', '{$ip}', '{$id}', '".time()."'";
//add request info to db
$sql->db_Insert("download_requests", $request_data, FALSE);
if (preg_match("/Binary\s(.*?)\/.*/", $download_url, $result))
$sql->insert("download_requests", $request_data, FALSE);
// if (preg_match("/Binary\s(.*?)\/.*/", $download_url, $result))
// {
// $bid = $result[1];
/// $result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
// $binary_data = @mysql_result($result, 0, "binary_data");
// $binary_filetype = @mysql_result($result, 0, "binary_filetype");
// $binary_name = @mysql_result($result, 0, "binary_name");
// header("Content-type: {$binary_filetype}");
// header("Content-length: {$download_filesize}");
// header("Content-Disposition: attachment; filename={$binary_name}");
// header("Content-Description: PHP Generated Data");
// echo $binary_data;
// exit();
// }
if (strstr($row['download_url'], "http://") || strstr($row['download_url'], "ftp://") || strstr($row['download_url'], "https://"))
{
$bid = $result[1];
$result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
$binary_data = @mysql_result($result, 0, "binary_data");
$binary_filetype = @mysql_result($result, 0, "binary_filetype");
$binary_name = @mysql_result($result, 0, "binary_name");
header("Content-type: {$binary_filetype}");
header("Content-length: {$download_filesize}");
header("Content-Disposition: attachment; filename={$binary_name}");
header("Content-Description: PHP Generated Data");
echo $binary_data;
exit();
}
if (strstr($download_url, "http://") || strstr($download_url, "ftp://") || strstr($download_url, "https://"))
{
$download_url = e107::getParser()->parseTemplate($download_url,true); // support for shortcode-driven dynamic URLS.
$download_url = e107::getParser()->parseTemplate($row['download_url'],true); // support for shortcode-driven dynamic URLS.
e107::redirect(decorate_download_location($download_url));
// header("Location: {$download_url}");
exit();
}
else
{
if (file_exists(e_DOWNLOAD.$download_url))
if (file_exists(e_DOWNLOAD.$row['download_url']))
{
e107::getFile()->send(e_DOWNLOAD.$download_url);
e107::getFile()->send(e_DOWNLOAD.$row['download_url']);
exit();
}
elseif(file_exists($download_url))
elseif(file_exists($row['download_url']))
{
e107::getFile()->send($download_url);
e107::getFile()->send($row['download_url']);
exit();
}
elseif(file_exists(e_UPLOAD.$download_url))
elseif(file_exists(e_UPLOAD.$row['download_url']))
{
e107::getFile()->send(e_UPLOAD.$download_url);
e107::getFile()->send(e_UPLOAD.$row['download_url']);
exit();
}
$log->addError("Couldn't find ".e_DOWNLOAD.$download_url." or ".$download_url." or ".e_UPLOAD.$download_ur);
$log->addError("Couldn't find ".e_DOWNLOAD.$row['download_url']." or ".$row['download_url']." or ".e_UPLOAD.$row['download_url']);
$log->toFile('download_requests','Download Requests', true); // Create a log file and add the log messages
}
}
@@ -266,7 +268,7 @@ if ($type == "file")
else if(strstr(e_QUERY, "pub_"))
{
/* check to see if public upload and not in download table ... */
$bid = str_replace("pub_", "", e_QUERY);
/*$bid = str_replace("pub_", "", e_QUERY);
if($result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '$bid' "))
{
$binary_data = @mysql_result($result, 0, "binary_data");
@@ -278,14 +280,14 @@ if ($type == "file")
header("Content-Description: PHP Generated Data");
echo $binary_data;
exit();
}
}*/
}
$log->addError("Line".__LINE__.": Couldn't find ".e_DOWNLOAD.e_QUERY);
$log->toFile('download_requests','Download Requests', true); // Create a log file and add the log messages
require_once(HEADERF);
$ns -> tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."<br /><br /><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."<br /><br /><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
require_once(FOOTERF);
exit();
}
@@ -293,10 +295,10 @@ if ($type == "file")
$sql->select($table, "*", "{$table}_id = '{$id}'");
$row = $sql->fetch();
extract($row);
$image = ($table == "upload" ? $upload_ss : $download_image);
if (preg_match("/Binary\s(.*?)\/.*/", $image, $result))
{
$bid = $result[1];
$image = ($table == "upload" ? $row['upload_ss'] : $row['download_image']);
//if (preg_match("/Binary\s(.*?)\/.*/", $image, $result))
//{
/* $bid = $result[1];
$result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
$binary_data = @mysql_result($result, 0, "binary_data");
$binary_filetype = @mysql_result($result, 0, "binary_filetype");
@@ -304,11 +306,12 @@ if (preg_match("/Binary\s(.*?)\/.*/", $image, $result))
header("Content-type: {$binary_filetype}");
header("Content-Disposition: inline; filename={$binary_name}");
echo $binary_data;
exit();
}
exit();*/
//}
$image = ($table == "upload" ? $upload_ss : $download_image);
// $image = ($table == "upload" ? $upload_ss : $download_image);
if (strpos($image, "http") !== FALSE)
{
@@ -338,7 +341,7 @@ else
$disp .= "<br /><div style='text-align:center'><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>";
$ns->tablerender($imagecaption, $disp);
e107::getRender()->tablerender($imagecaption, $disp);
require_once(FOOTERF);
} else
@@ -354,7 +357,7 @@ else
else
{
require_once(HEADERF);
$ns->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."<br /><br /><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
e107::getRender()->tablerender(LAN_ERROR, "<div style='text-align:center'>".LAN_FILE_NOT_FOUND."<br /><br /><a href='javascript:history.back(1)'>".LAN_BACK."</a></div>");
require_once(FOOTERF);
exit;
}
@@ -366,7 +369,7 @@ else
function check_download_limits()
{
global $pref, $sql, $ns, $HEADER, $e107, $tp;
global $pref, $sql, $HEADER;
// Check download count limits
$qry = "SELECT gen_intdata, gen_chardata, (gen_intdata/gen_chardata) as count_perday FROM #generic WHERE gen_type = 'download_limit' AND gen_datestamp IN (".USERCLASS_LIST.") AND (gen_chardata >= 0 AND gen_intdata >= 0) ORDER BY count_perday DESC";
if($sql->gen($qry))

View File

@@ -245,7 +245,7 @@ function parse_forum($f, $restricted_string = '')
function parse_subs($forumList, $id ='', $lastpost_datestamp)
function parse_subs($forumList, $id, $lastpost_datestamp)
{
$tp = e107::getParser();

View File

@@ -17,7 +17,7 @@
protected $e107;
protected $defaultImgAttachSize = false;
protected $pref;
public $pref;
// $param is sent from nfp menu.
function __construct()
@@ -1264,13 +1264,6 @@
return $text;
}
if(E107_DEBUG_LEVEL > 0)
{
// echo "<div class='alert alert-info'>Thread id: ".$threadId."</div>";
// print_a($this);
}
// Preview should be reserved for the full 'Post reply' page. <input type='submit' name='fpreview' value='" . Preview . "' /> &nbsp;
}
//---- else

View File

@@ -384,8 +384,13 @@ class html_import extends base_import_class
}
function process($type='description',$source)
function process($type, $source)
{
if(empty($type))
{
$type = 'description';
}
switch ($type)
{
case 'category':

View File

@@ -183,7 +183,10 @@ class listclass
}
}
//sort array on order values set in preferences
usort($arr, create_function('$e,$f','return $e["order"]==$f["order"]?0:($e["order"]>$f["order"]?1:-1);'));
usort($arr, function($e, $f)
{
return $e["order"]==$f["order"] ? 0 : ($e["order"] > $f["order"] ? 1 : -1);
});
return $arr;
}

View File

@@ -174,7 +174,7 @@ function getBrowser($agent)
"konqueror" => array('name' => 'Konqueror', 'rule' => 'konqueror/([0-9.]{1,10})'),
"avantbrowser" => array('name' => 'Avant Browser', 'rule' => 'Avant[ ]?Browser'),
"avantgo" => array('name' => 'AvantGo', 'rule' => 'AvantGo[ /]([0-9.]{1,10})'),
"proxomitron" => array('name' => 'Proxomitron', 'rule' => 'Space[ ]?Bison/[0-9.]{1,10}'),
// "proxomitron" => array('name' => 'Proxomitron', 'rule' => 'Space[ ]?Bison/[0-9.]{1,10}'),
"lynx" => array('name' => 'Lynx', 'rule' => 'lynx/([0-9a-z.]{1,10})'),
"links" => array('name' => 'Links', 'rule' => 'Links[ /]\(([0-9.]{1,10})'),
"galeon" => array('name' => 'Galeon', 'rule' => 'galeon/([0-9.]{1,10})'),

View File

@@ -364,7 +364,7 @@ class siteStats
'Konqueror' => "konqueror",
'Avant Browser' => "avantbrowser",
'AvantGo' => "avantgo",
'Proxomitron' => "proxomitron",
// 'Proxomitron' => "proxomitron",
'Safari' => "safari",
'Lynx' => "lynx",
'Links' => "links",
@@ -1989,7 +1989,8 @@ class siteStats
function getWidthRatio ($array, $column)
{
$tmpArray = $this -> arraySort($array, $column);
$data = each($tmpArray);
// $data = each($tmpArray);
$data = key($tmpArray);
$maxValue = $data[1]['totalv'];
echo "<b>maxValue</b> ".$maxValue." <br />";
$ratio = 0;

View File

@@ -114,7 +114,7 @@ class login_menu_class
}
function parse_external_list($active=false, $order=true)
function parse_external_list($active=false, $order=true)
{
//prevent more than 1 call
if(($tmp = getcachedvars('loginbox_elist')) !== FALSE) return $tmp;
@@ -377,7 +377,10 @@ class login_menu_class
function clean_links($link_items)
{
if(empty($link_items)) return;
if(empty($link_items))
{
return array();
}
foreach($link_items as $key => $value)
{

View File

@@ -317,24 +317,42 @@ e107::getLanguage()->bcDefs($bcDefs);
function sc_lm_external_links($parm='')
{
global $menu_pref, $login_menu_shortcodes, $LOGIN_MENU_EXTERNAL_LINK;
$tp = e107::getParser();
$lmc = new login_menu_class;
if(!vartrue($menu_pref['login_menu']['external_links'])) return '';
$lbox_infos = login_menu_class::parse_external_list(true, false);
$lbox_active = $menu_pref['login_menu']['external_links'] ? explode(',', $menu_pref['login_menu']['external_links']) : array();
if(!vartrue($lbox_infos['links'])) return '';
$ret = '';
foreach ($lbox_active as $stackid) {
$lbox_items = login_menu_class::clean_links(varset($lbox_infos['links'][$stackid]));
if(!$lbox_items) continue;
foreach ($lbox_items as $num=>$lbox_item) {
$lbox_item['link_id'] = $stackid.'_'.$num;
cachevars('login_menu_linkdata', $lbox_item);
$ret .= $tp -> parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes);
}
if(!vartrue($menu_pref['login_menu']['external_links']))
{
return '';
}
$lbox_infos = $lmc->parse_external_list(true, false);
$lbox_active = $menu_pref['login_menu']['external_links'] ? explode(',', $menu_pref['login_menu']['external_links']) : array();
if(!vartrue($lbox_infos['links']))
{
return '';
}
$ret = '';
foreach($lbox_active as $stackid)
{
$lbox_items = $lmc->clean_links(varset($lbox_infos['links'][$stackid]));
if(!$lbox_items)
{
continue;
}
foreach($lbox_items as $num => $lbox_item)
{
$lbox_item['link_id'] = $stackid . '_' . $num;
cachevars('login_menu_linkdata', $lbox_item);
$ret .= $tp->parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes);
}
}
return $ret;
}
@@ -420,7 +438,9 @@ e107::getLanguage()->bcDefs($bcDefs);
if(!vartrue($menu_pref['login_menu']['external_stats'])) return '';
$lbox_infos = login_menu_class::parse_external_list(true, false);
$lm = new login_menu_class;
$lbox_infos = $lm->parse_external_list(true, false);
if(!vartrue($lbox_infos['stats'])) return '';

View File

@@ -548,14 +548,14 @@ class newsletter
/**
* Delete a newsletter
*
* @return none
* @return null
*/
function deleteNewsletter()
{
$sql = e107::getDb();
$mes = e107::getMessage();
$tmp = each($_POST['delete']);
$tmp = key($_POST['delete']);
if(strpos($tmp['key'], 'newsletter') === 0)
{
$id = intval(str_replace('newsletter_', '', $tmp['key']));

View File

@@ -27,14 +27,17 @@ $frm = e107::getForm();
if (isset($_POST['update_menu']))
{
$temp = array();
while (list($key, $value) = each($_POST))
foreach($_POST as $key=>$value)
{
if ($value != LAN_UPDATE)
{
$temp[$key] = $value;
}
}
if ($admin_log->logArrayDiffs($temp,$menu_pref,'MISC_02'))
$menu_pref = e107::getConfig('menu')->getPref();
if (e107::getLog()->logArrayDiffs($temp,$menu_pref,'MISC_02'))
{
$menuPref = e107::getConfig('menu');
//e107::getConfig('menu')->setPref('', $menu_pref);
@@ -47,12 +50,12 @@ if (isset($_POST['update_menu']))
$mes->addSuccess(LAN_SAVED);
}
//$ns->tablerender('', "<div style='text-align:center'><b>".LAN_UPDATED.'</b></div>');
$ns->tablerender($caption, $mes->render() . $text);
//e107::getRender()->tablerender(null, $mes->render() );
echo $mes->render();
}
$menu_pref = e107::getConfig('menu')->getPref('');
$menu_pref = e107::getConfig('menu')->getPref();
if (!isset($menu_pref['online_ls_caption']))
{ // Assume that if one isn't set, none are set
@@ -80,7 +83,7 @@ $text = "
<td colspan='2'>".LAN_ONLINE_ADMIN_1."</td></tr>
<tr>
<td>".LAN_ONLINE_ADMIN_2.":</td>
<td><input class='tbox' type='text' name='online_ls_caption' size='30' value='".$tp->toHTML($menu_pref['online_ls_caption'],"","defs")."' maxlength='200' /></td>
<td><input class='tbox' type='text' name='online_ls_caption' size='30' value='".e107::getParser()->toHTML($menu_pref['online_ls_caption'],"","defs")."' maxlength='200' /></td>
</tr>
<tr>
<td>".LAN_ONLINE_ADMIN_3.":</td>
@@ -102,7 +105,7 @@ $text = "
</tr>
<tr>
<td>".LAN_ONLINE_ADMIN_5.":</td>
<td><input class='tbox' type='text' name='online_caption' size='30' value='".$tp->toHTML($menu_pref['online_caption'],"","defs")."' maxlength='200' /></td>
<td><input class='tbox' type='text' name='online_caption' size='30' value='".e107::getParser()->toHTML($menu_pref['online_caption'],"","defs")."' maxlength='200' /></td>
</tr>
<tr>
<td>".LAN_ONLINE_ADMIN_10."</td>
@@ -124,5 +127,5 @@ $text = "
</fieldset>
</form>";
$ns->tablerender(LAN_ONLINE_ADMIN_4." - ".LAN_ONLINE_ADMIN_1, $mes->render() . $text);
e107::getRender()->tablerender(LAN_ONLINE_ADMIN_4." - ".LAN_ONLINE_ADMIN_1, $mes->render() . $text);
require_once(e_ADMIN."footer.php");

View File

@@ -257,7 +257,7 @@ class tinymce
/**
* Render Field value (listing page)
*
* @param array $key
* @param string $key
* @param array $row
* @return string
*/

View File

@@ -119,8 +119,10 @@ $config = varset($_GET['config'],false); // e_QUERY;
$gen = $wy->renderConfig($config);
define('USE_GZIP', true);
$compression_browser_support = false;
$compression_server_support = false;
if(strstr(varset($_SERVER['HTTP_ACCEPT_ENCODING'], ''), 'gzip'))
if(strstr(varset($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip'))
{
$compression_browser_support = true;
}
@@ -143,16 +145,19 @@ if(ADMIN && e_QUERY == 'debug' || !empty($_GET['debug']))
</td>
</tr></table>";
echo "<br />Browser gZip support: ".$compression_browser_support;
echo "<br />Server gZip support: ". $compression_server_support;
// echo "<br />Browser gZip support: ".$compression_browser_support;
// echo "<br />Server gZip support: ". $compression_server_support;
require_once(FOOTERF);
}
elseif((USE_GZIP === true) && $compression_browser_support && $compression_server_support)
{
while (@ob_end_clean()); // clear out anything that may have been echoed from class2.php or theme
header('Content-type: text/javascript;charset=UTF-8', true);
while (ob_get_length() !== false) // clear out anything that may have been echoed from class2.php or theme
{
ob_end_clean();
}
header('Content-type: text/javascript;charset=UTF-8');
header('Content-Encoding: gzip');
$minified = e107::minify($gen);
@@ -163,7 +168,10 @@ elseif((USE_GZIP === true) && $compression_browser_support && $compression_serve
}
else
{
while (@ob_end_clean()); // clear out anything that may have been echoed from class2.php or theme.
while (ob_get_length() !== false) // clear out anything that may have been echoed from class2.php or theme
{
ob_end_clean();
}
ob_start();
ob_implicit_flush(0);
header('Content-type: text/javascript', TRUE);
@@ -180,9 +188,9 @@ exit;
class wysiwyg
{
var $js;
var $config = array();
var $configName;
public $js;
public $config = array();
public $configName;
function renderConfig($config='')
{
@@ -199,7 +207,7 @@ class wysiwyg
},\n";
*/
$text .= $this->config; // Moc: temporary fix for BC with PHP 5.3: https://github.com/e107inc/e107/issues/614
// $text .= $this->config; // Moc: temporary fix for BC with PHP 5.3: https://github.com/e107inc/e107/issues/614
$text .= "\n});";
@@ -329,7 +337,7 @@ class wysiwyg
{
if(empty($data))
{
return;
return null;
}
$tmp = explode(" ",$data);
@@ -396,7 +404,7 @@ class wysiwyg
function getConfig($config=false)
{
$tp = e107::getParser();
$fl = e107::getFile();
// $fl = e107::getFile();
if($config !== false)
{

View File

@@ -16,7 +16,7 @@
*/
$eplug_admin = true;
require_once("../../class2.php");
$pref = e107::pref();
if (!getperms("P") || !e107::isInstalled('trackback') || !$pref['trackbackEnabled'])
{
e107::redirect();
@@ -27,37 +27,40 @@ require_once(e_ADMIN."auth.php");
if (isset($_POST['moderate']))
{
$temp = array();
$sql = e107::getDb();
if (is_array($_POST['trackback_delete']))
{
while (list ($key, $cid) = each ($_POST['trackback_delete']))
foreach($_POST['trackback_delete'] as $key=>$cid)
{
$cid = intval($cid);
if ($cid > 0)
{
$sql->db_Delete("trackback", "trackback_id=".$cid);
$sql->delete("trackback", "trackback_id=".$cid);
$temp[] = $cid;
}
}
if (count($temp))
{
e107::getLog()->add('TRACK_02',implode(', ',$temp), E_LOG_INFORMATIVE,'');
e107::getLog()->add('TRACK_02',implode(', ',$temp));
}
}
$ns->tablerender("", "<div style='text-align:center'><b>".TRACKBACK_L15."</b></div>");
$e107cache->clear("news.php");
e107::getRender()->tablerender(null, "<div style='text-align:center'><b>".LAN_DELETED."</b></div>");
e107::getCache()->clear("news.php");
}
$sql = e107::getDb();
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."?".e_QUERY."'>
<table style='".ADMIN_WIDTH."' class='fborder'>";
if (e_QUERY=='all')
{
$res=$sql->db_Select("trackback", "*");
$res=$sql->select("trackback");
}
else
{
$res=$sql->db_Select("trackback", "*", "trackback_pid=".intval(e_QUERY));
$res=$sql->select("trackback", "*", "trackback_pid=".intval(e_QUERY));
}
if (!$res)
@@ -67,20 +70,20 @@ if (!$res)
else
{
$tbArray = $sql -> db_getList();
foreach($tbArray as $trackback)
foreach($tbArray as $row)
{
extract($trackback);
$text .= "<tr>
<td class='forumheader3' style='width: 30%;'><a href='$trackback_url' rel='external'>$trackback_title</a></td>
<td class='forumheader3' style='width: 40%;'>$trackback_excerpt</td>
<td class='forumheader3' style='width: 20%;'>$trackback_blogname</td>
<td class='forumheader3' style='width: 10%;'><input type='checkbox' name='trackback_delete[]' value='$trackback_id' /> ".TRACKBACK_L14."</td>
<td class='forumheader3' style='width: 30%;'><a href='".$row['trackback_url']."' rel='external'>".$row['trackback_title']."</a></td>
<td class='forumheader3' style='width: 40%;'>".$row['trackback_excerpt']."</td>
<td class='forumheader3' style='width: 20%;'>".$row['trackback_blogname']."</td>
<td class='forumheader3' style='width: 10%;'><input type='checkbox' name='trackback_delete[]' value='".$row['trackback_id']."' /> ".LAN_DELETE."</td>
</tr>\n";
}
$text .= "<tr><td colspan='5' class='forumheader' style='text-align:center'><input class='btn btn-default btn-secondary button' type='submit' name='moderate' value='".TRACKBACK_L13."' /></td></tr></table></form></div>";
}
$ns->tablerender(TRACKBACK_L13, $text);
e107::getRender()->tablerender(TRACKBACK_L13, $text);
require_once(e_ADMIN."footer.php");

View File

@@ -21,5 +21,5 @@ if (!e107::isInstalled('trackback'))
}
header('Content-Type: text/xml');
include(e_PLUGIN."trackback/trackbackClass.php");
$trackback = trackbackClass :: respondTrackback();
$trackback = trackbackClass::respondTrackback();

View File

@@ -20,7 +20,7 @@ if (!defined('e107_INIT')) { exit; }
class trackbackClass
{
function sendTrackback ($permLink, $pingUrl, $title, $excerpt)
static function sendTrackback ($permLink, $pingUrl, $title, $excerpt)
{
global $e107;
@@ -98,7 +98,7 @@ class trackbackClass
}
function respondTrackback ()
static function respondTrackback ()
{
global $sql, $pref, $tp, $e107cache;
$errorMessage = "";
@@ -151,7 +151,7 @@ class trackbackClass
if(!$errorMessage)
{
if(!$sql -> db_Insert("trackback", "0, {$pid}, '{$title}', '{$excerpt}', '{$permLink}', '{$blog_name}' "))
if(!$sql->insert("trackback", "0, {$pid}, '{$title}', '{$excerpt}', '{$permLink}', '{$blog_name}' "))
{
$errorMessage = "Unable to enter your trackback information into the database -> 0, {$pid}, '{$title}', '{$excerpt}', '{$permLink}', '{$blog_name}'";
}

View File

@@ -25,7 +25,7 @@ class e_fileTest extends \Codeception\Test\Unit
}
catch (Exception $e)
{
$this->fail("Couldn't load e_file object");
$this->fail($e->getMessage());
}
$this->exploitFile = e_TEMP."test_exploit_file.jpg";

View File

@@ -9,8 +9,6 @@ e107::meta('viewport', 'width=device-width, initial-scale=1.0');
//e107::library('load', 'bootstrap');
define('BOOTSTRAP', 3);
//e107::js('theme', 'js/theme.js');
// e107::css('theme','assets/css/style.css');
@@ -59,6 +57,8 @@ function tablestyle($caption, $text, $mode='')
// IMPORTANT: make sure there are no characters after <<<TMPL or TMPL;
// DEFAULT
$HEADER = array();
$FOOTER = array();
$HEADER['default'] = <<<TMPL
@@ -164,4 +164,3 @@ $NEWSCAT_ITEM = '
';
?>

View File

@@ -5,6 +5,10 @@
<description>Blank e107 Theme</description>
<category>generic</category>
<compliance xhtml="1.1" css="2.1" />
<libraries>
<library name="bootstrap" version="3" scope="all"/>
<library name="fontawesome" version="4" scope="all"/>
</libraries>
<plugins>
<plugin name='chatbox_menu' url='core' />
</plugins>

View File

@@ -59,14 +59,14 @@ if(function_exists('ini_get'))
}
if($register_globals == true)
{
while (list($global) = each($GLOBALS))
foreach($GLOBALS as $global=>$tmp);
{
if (!preg_match('/^(_POST|_GET|_COOKIE|_SERVER|_FILES|GLOBALS|HTTP.*|_REQUEST|eTimingStart)$/', $global))
{
unset($$global);
}
}
unset($global);
unset($global,$tmp);
}
@@ -79,8 +79,8 @@ if (!isset($mySQLprefix)) return FALSE;
$hash = substr(md5($mySQLdefaultdb.".".$mySQLprefix),0,10);
mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
mysql_select_db($mySQLdefaultdb);
//mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
//mysql_select_db($mySQLdefaultdb);
define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE : FALSE));
define('e_CACHE', $siteRoot.$SYSTEM_DIRECTORY.$hash.'/cache/');