1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-26 07:44:49 +02:00

Code cleanup

This commit is contained in:
Cameron
2020-12-05 14:13:18 -08:00
parent d37d4bf8af
commit 09fb747374
30 changed files with 125 additions and 89 deletions

View File

@@ -131,7 +131,7 @@ class alt_auth_admin extends alt_auth_base
* Returns a block of table rows with user DB fields and either checkboxes or entry boxes
*
* @param string $tableType is the prefix used, without the following underscore
* @param $frm is the form object to use to create the text
* @param object $frm is the form object to use to create the text
* @param array $parm is the array of options for the current auth type as read from the DB
*/
public function alt_auth_get_field_list($tableType, $frm, $parm, $asCheckboxes = FALSE)
@@ -141,11 +141,11 @@ class alt_auth_admin extends alt_auth_base
{
if (vartrue($v['showAll']) || vartrue($v[$tableType]))
{
$ret .= "<tr><td$log>";
$ret .= "<tr><td>";
if ($v['optional'] == FALSE) $ret .= '*&nbsp;';
$ret .= $v['prompt'].':';
$ret .= "</td><td class='form-inline' $log>";
$ret .= "</td><td class='form-inline'>";
// $fieldname = $tableType.'_'.$v['optname'];
$fieldname = $tableType.'_xf_'.$f; // Name of the input box
$value = varset($v['default'],'');
@@ -266,7 +266,7 @@ class alt_auth_admin extends alt_auth_base
* Each is a row of a table having two columns (no <table>...</table> etc added, so can be embedded in a larger table
*
* @param string $prefix is the prefix used, without the following underscore
* @param $frm is the form object to use
* @param object $frm is the form object to use
* @param array $parm is an array of the current values of each item
* @param string $fields is a list of the fields to display, separated by '|'. The names are the key values from $common_fields table
*
@@ -279,9 +279,9 @@ class alt_auth_admin extends alt_auth_base
{
if (in_array($fn,$opts))
{
$ret .= "<tr><td$log>".$cf['prompt'];
$ret .= "<tr><td>".$cf['prompt'];
$ret .= "</td><td$log>";
$ret .= "</td><td>";
if ($cf['fieldname'] == 'password')
{
@@ -352,7 +352,8 @@ class alt_auth_admin extends alt_auth_base
*/
public function altAuthGetPasswordSelector($name, $frm, $currentSelection = '', $getExtended = FALSE)
{
$password_methods = ExtendedPasswordHandler::GetPasswordTypes($getExtended);
$ext = new ExtendedPasswordHandler;
$password_methods = $ext->getPasswordTypes($getExtended);
$text = "";
$text .= $frm->form_select_open($name);
foreach($password_methods as $k => $v)
@@ -477,12 +478,12 @@ class alt_auth_admin extends alt_auth_base
</colgroup>
<tr><th colspan='2'>".LAN_ALT_42."</th></tr>";
$text .= "<tr><td $log>".LAN_ALT_33."</td><td $log>";
$text .= "<tr><td>".LAN_ALT_33."</td><td>";
// $text .= $frm->form_text('nametovalidate', 35, '', 120);
$text .= e107::getForm()->text('nametovalidate','',35);
$text .= "</td></tr>";
$text .= "<tr><td $log>".LAN_ALT_34."</td><td $log>";
$text .= "<tr><td>".LAN_ALT_34."</td><td>";
$text .= $frm->form_password('passtovalidate', 35, '', 120);
$text .= "</td></tr>";
@@ -550,10 +551,10 @@ class alt_auth_admin extends alt_auth_base
function alt_auth_adminmenu()
{
echo ' ';
if(!is_array($authlist))
/*if(!is_array($authlist))
{
$authlist = alt_auth_admin::alt_auth_get_authlist();
}
}*/
define('ALT_AUTH_ACTION', 'main');
$var['main']['text'] = LAN_ALT_31;
@@ -567,6 +568,7 @@ function alt_auth_adminmenu()
$var = array();
/*
foreach($authlist as $a)
{
if($a != 'e107')
@@ -574,10 +576,10 @@ function alt_auth_adminmenu()
$var[$a]['text'] = LAN_ALT_30.$a;
$var[$a]['link'] = e_PLUGIN."alt_auth/{$a}_conf.php";
}
}
}*/
show_admin_menu(LAN_ALT_29, ALT_AUTH_ACTION, $var);
// show_admin_menu(LAN_ALT_29, ALT_AUTH_ACTION, $var);
}

View File

@@ -242,7 +242,8 @@ class alt_login
switch($login_result)
{
case AUTH_NOCONNECT:
if(varset(e107::getPref('auth_noconn'), TRUE))
$noconn = e107::getPref('auth_noconn');
if(varset($noconn, TRUE))
{
$this->loginResult = LOGIN_TRY_OTHER;
return;
@@ -252,7 +253,8 @@ class alt_login
return;
case AUTH_BADPASSWORD:
case AUTH_NOUSER:
if(varset(e107::getPref('auth_badpassword'), TRUE))
$badpass = e107::getPref('auth_badpassword');
if(varset($badpass, TRUE))
{
$this->loginResult = LOGIN_TRY_OTHER;
return;

View File

@@ -155,7 +155,7 @@ class banner_ui extends e_admin_ui
// ------- Customize Create --------
public function beforeCreate($new_data, $old_data)
{
// e107::getMessage()->addDebug(print_a($new_data,true));
@@ -439,7 +439,7 @@ class banner_form_ui extends e_admin_form_ui
function banner_image($curVal,$mode)
{
$frm = e107::getForm();
switch($mode)
{
@@ -486,6 +486,8 @@ class banner_form_ui extends e_admin_form_ui
return $this->clients;
break;
}
return null;
}
@@ -523,6 +525,8 @@ class banner_form_ui extends e_admin_form_ui
return $this->clients;
break;
}
return null;
}
@@ -546,6 +550,8 @@ class banner_form_ui extends e_admin_form_ui
return null;
break;
}
return null;
}
// Custom Method/Function
@@ -616,15 +622,14 @@ class banner_form_ui extends e_admin_form_ui
{
return null;
}
$frm = e107::getForm();
unset($curVal); // keep inspector happy.
$banner_row = $this->getController()->getListModel()->getData();
// return print_a($banner_row,true);
$clickpercentage = ($banner_row['banner_clicks'] && $banner_row['banner_impressions'] ? round(($banner_row['banner_clicks'] / $banner_row['banner_impressions']) * 100,1)."%" : "-");
return $clickpercentage;
return ($banner_row['banner_clicks'] && $banner_row['banner_impressions'] ? round(($banner_row['banner_clicks'] / $banner_row['banner_impressions']) * 100,1)."%" : "-");
//$impressions_left = ($banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] - $banner_row['banner_impressions'] : BANNERLAN_30);
// $impressions_purchased = ($banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] : BANNERLAN_30);
}
@@ -633,7 +638,7 @@ class banner_form_ui extends e_admin_form_ui
}
new banner_admin();
new banner_admin;
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();

View File

@@ -127,7 +127,8 @@ class download
{
if (is_numeric($tmp[0])) //legacy // $tmp[0] at least must be valid
{
$this->qry['action'] = varset(preg_replace("#\W#", "", $tp->toDB($tmp[1])),'list');
$parsed = preg_replace("#\W#", "", $tp->toDB($tmp[1]));
$this->qry['action'] = varset($parsed,'list');
$this->qry['id'] = intval($tmp[2]);
$this->qry['view'] = intval($tmp[3]);
$this->qry['order'] = preg_replace("#\W#", "", $tp->toDB($tmp[4]));

View File

@@ -177,16 +177,19 @@ if (isset($_POST['commentsubmit']))
require_once (HEADERF);
$ns->tablerender($ftmp['caption'], $ftmp['text']);
e107::getRender()->tablerender($ftmp['caption'], $ftmp['text']);
}
if($action == "cat" && $idx)
{
$ftmp = $faq->view_faq($idx) ;
define("e_PAGETITLE",LAN_FAQS_011." - ". $ftmp['title']);
if(!defined("e_PAGETITLE"))
{
define("e_PAGETITLE", LAN_FAQS_011." - ". $ftmp['title']);
}
require_once(HEADERF);
$ns->tablerender($ftmp['caption'], $ftmp['text']);
e107::getRender()->tablerender($ftmp['caption'], $ftmp['text']);
}
if ($action == "cat")
@@ -195,7 +198,7 @@ if (isset($_POST['commentsubmit']))
define("e_PAGETITLE", strip_tags($ftmp['title'].$ftmp['caption']));
require_once (HEADERF);
$ns->tablerender($ftmp['caption'], $ftmp['text']);
e107::getRender()->tablerender($ftmp['caption'], $ftmp['text']);
}

View File

@@ -32,7 +32,8 @@ class featurebox_shortcodes// must match the plugin's folder name. ie. [PLUGIN_F
if($parm == null && $mod == '') // ie {FEATUREBOX}
{
$type = vartrue(e107::getPlugPref('featurebox','menu_category'),'bootstrap_carousel');
$menCat = e107::getPlugPref('featurebox','menu_category');
$type = vartrue($menCat,'bootstrap_carousel');
$text = e107::getParser()->parseTemplate("{FEATUREBOX|".$type."}");
return $text;

View File

@@ -9,8 +9,8 @@ if (!defined('e107_INIT')) { exit; }
// e107::Lan('featurebox', 'front');
e107::includeLan(e_PLUGIN.'featurebox/languages/'.e_LANGUAGE.'_admin_featurebox.php'); // This line added to admin warning
$type = vartrue(e107::getPlugPref('featurebox','menu_category'),'bootstrap_carousel');
$cat = e107::getPlugPref('featurebox','menu_category');
$type = vartrue($cat,'bootstrap_carousel');
$text = e107::getParser()->parseTemplate("{FEATUREBOX|".$type."}");
if(empty($text))

View File

@@ -219,8 +219,8 @@ function parse_forum($f, $restricted_string = '')
if(!empty($forumList['subs']) && is_array($forumList['subs'][$f['forum_id']]))
{
$lastpost_datestamp = reset(explode('.', $f['forum_lastpost_info']));
$lastPost = explode('.', $f['forum_lastpost_info']);
$lastpost_datestamp = reset($lastPost);
$ret = parse_subs($forumList, $f['forum_id'], $lastpost_datestamp);
$f['forum_threads'] += $ret['threads'];

View File

@@ -291,7 +291,7 @@ class forum_shortcodes extends e_shortcode
$forum = new e107forum;
//$trackPref = $forum->prefs->get('track');
//if (USER && vartrue($trackPref) && e_QUERY != 'track')
if (USER && vartrue($forum->prefs->get('track')) && e_QUERY != 'track')
if (USER && !empty($forum->prefs->get('track')) && e_QUERY != 'track')
{
$text .= "<br /><a href='".e107::url('forum','track')."'>".LAN_FORUM_0030.'</a>';
}

View File

@@ -120,7 +120,7 @@ class plugin_gallery_index_controller extends eControllerFront
$sc = e107::getScBatch('gallery', true);
$sc->breadcrumb();
$text = "";
// $text = "";
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
{
@@ -132,7 +132,7 @@ class plugin_gallery_index_controller extends eControllerFront
foreach($this->catList as $val)
{
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['cat']['item'], true);
$text .= e107::getParser()->parseTemplate($template['cat']['item']);
}
$text .= e107::getParser()->parseTemplate($template['cat']['end'], true, $sc);

View File

@@ -223,7 +223,8 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_slideshow($parm = '')
{
$this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1);
$slideCat = e107::getPlugPref('gallery', 'slideshow_category');
$this->sliderCat = ($parm) ? $parm : vartrue($slideCat, 1);
$tmpl = e107::getTemplate('gallery', 'gallery');
$template = array_change_key_case($tmpl);
@@ -241,7 +242,8 @@ class gallery_shortcodes extends e_shortcode
$ns = e107::getRender();
$tp = e107::getParser();
// $parm = eHelper::scParams($parms);
$cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), false); //TODO Separate pref?
$slideCat = e107::getPlugPref('gallery', 'slideshow_category');
$cat = (!empty($parm['category'])) ? $parm['category'] : vartrue($slideCat, false); //TODO Separate pref?
$tmpl = e107::getTemplate('gallery', 'gallery');
$limit = vartrue($parm['limit'], 6);

View File

@@ -1,4 +1,4 @@
<?php /** @noinspection PhpMissingFieldTypeInspection */
<?php
/*
* e107 website system
*

View File

@@ -1,4 +1,4 @@
<?php /** @noinspection PhpMissingReturnTypeInspection */
<?php
/*
* e107 website system
*

View File

@@ -36,7 +36,8 @@ class phpbb3_import extends base_import_class
function init()
{
$this->forum_attachment_path = vartrue(trim($_POST['forum_attachment_path'],"/" ), false);
$formattach = trim($_POST['forum_attachment_path'],"/" );
$this->forum_attachment_path = vartrue($formattach, false);
if($data = e107::getDb('phpbb')->retrieve('userclass_classes','userclass_id',"userclass_name='FORUM_MODERATOR' "))
{

View File

@@ -198,7 +198,7 @@ class rss_import extends base_import_class
}
function process($type='description',$source)
function process($type,$source)
{
switch ($type)
{

View File

@@ -86,7 +86,8 @@ class login_menu_class
{
foreach ($list_arr as $item)
{
$tmp = end(explode('/', trim($item['path'], '/.')));
$path = explode('/', trim($item['path'], '/.'));
$tmp = end($path);
if(e107::isInstalled($tmp))
{

View File

@@ -118,7 +118,7 @@ class newsfeed_ui extends e_admin_ui
// ------- Customize Create --------
public function beforeCreate($new_data)
public function beforeCreate($new_data, $old_data)
{
if(isset($new_data['newsfeed_showmenu']))
{

View File

@@ -27,13 +27,15 @@ if(e_QUERY)
{
$tmp = explode('.', e_QUERY);
$action = $tmp[0];
$action_parent_id = varset(intval($tmp[1], 0));
$action_nl_id = varset(intval($tmp[2], 0));
$parID = intval($tmp[1], 0);
$nlID = intval($tmp[2], 0);
$action_parent_id = varset($parID);
$action_nl_id = varset($nlID);
unset($tmp);
}
$page_size = 10; // Might become a preference setting later on
$text .= "<div style='text-align: center; margin-left: auto; margin-right: auto; width: 100%;'>";
$text = "<div style='text-align: center; margin-left: auto; margin-right: auto; width: 100%;'>";
if (($action <> 'show' && $action <> 'showp') || ($action_parent_id == 0))
{ // Action 'show' displays initial page, 'showp' displays following pages

View File

@@ -881,7 +881,7 @@ class private_msg_ui extends e_admin_ui
}
public function beforeCreate($new_data)
public function beforeCreate($new_data, $old_data)
{
if(empty($new_data['pm_to']))

View File

@@ -386,8 +386,15 @@ class private_message
$template = $PM_NOTIFY;
*/
if(THEME_LEGACY){include_once(THEME.'pm_template.php');}
if (!$PM_NOTIFY){$PM_NOTIFY = e107::getTemplate('pm', 'pm', 'notify');}
if(THEME_LEGACY)
{
include_once(THEME.'pm_template.php');
}
if(empty($PM_NOTIFY))
{
$PM_NOTIFY = e107::getTemplate('pm', 'pm', 'notify');
}
if(empty($PM_NOTIFY)) // BC Fallback.
{
@@ -858,7 +865,7 @@ class private_message
ignore_user_abort(true);
$data_len = filesize($filename);
if ($seek > ($data_len - 1)) $seek = 0;
$res =& fopen($filename, 'rb');
$res = fopen($filename, 'rb');
if ($seek)
{
fseek($res , $seek);

View File

@@ -637,7 +637,7 @@ class social_ui extends e_admin_ui
$frm = e107::getForm();
$textKeys = '';
$textScope = '';
$label = varset(self::getApiDocumentationUrlFor($provider_name)) ? "<a class='e-tip' rel='external' title=' " . LAN_SOCIAL_ADMIN_10 . "' href='" . self::getApiDocumentationUrlFor($provider_name) . "'>" . $pretty_provider_name . "</a>" : $pretty_provider_name;
$label = !empty(self::getApiDocumentationUrlFor($provider_name)) ? "<a class='e-tip' rel='external' title=' " . LAN_SOCIAL_ADMIN_10 . "' href='" . self::getApiDocumentationUrlFor($provider_name) . "'>" . $pretty_provider_name . "</a>" : $pretty_provider_name;
$radio_label = strtolower($provider_name);
$text = "<table class='table adminform'>
@@ -696,7 +696,7 @@ class social_ui extends e_admin_ui
$frm = e107::getForm();
$textKeys = '';
$textScope = '';
$label = varset(self::getApiDocumentationUrlFor($provider_name)) ? "<a class='e-tip' rel='external' title=' " . LAN_SOCIAL_ADMIN_10 . "' href='" . self::getApiDocumentationUrlFor($provider_name) . "'>" . $pretty_provider_name . "</a>" : $pretty_provider_name;
$label = !empty(self::getApiDocumentationUrlFor($provider_name)) ? "<a class='e-tip' rel='external' title=' " . LAN_SOCIAL_ADMIN_10 . "' href='" . self::getApiDocumentationUrlFor($provider_name) . "'>" . $pretty_provider_name . "</a>" : $pretty_provider_name;
$radio_label = strtolower($provider_name);
$text = "
<tr id='social-login-row-" . $radio_label."'>