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

Plugin script tests and PHP8 fixes.

This commit is contained in:
Cameron
2021-01-22 13:44:10 -08:00
parent 4b0edad459
commit acc1a9af0d
62 changed files with 799 additions and 1849 deletions

View File

@@ -1264,272 +1264,6 @@ require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
/*
* Currently unused function - shows available import methods and capabilities
*/
/*
function showStartPage()
{
global $emessage, $frm, $import_class_names, $import_class_support, $db_import_blocks, $import_class_comment;
$frm = e107::getForm();
$text = "
<form method='get' action='".e_SELF."' id='core-import-form'>
<fieldset id='core-import-select-type'>
<legend class='e-hideme'>".'DBLAN_10'."</legend>
".$frm->hidden('mode','main')."
".$frm->hidden('action','import')."
<table class='table adminlist'>
<colgroup>
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th>".LAN_CONVERT_06."</th>";
foreach($db_import_blocks as $name) // 1 column for each of users, news, forum etc.
{
$text .= "<th class='center'>".$name['message']."</th>";
}
$text.="
<th class='center'>".LAN_OPTIONS."</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src='".e_PLUGIN."import/images/csv.png' alt='' style='float:left;height:32px;width:32px;margin-right:4px'>CSV</td>
<td class='center'>".ADMIN_TRUE_ICON."</td>";
for ($i=0; $i < count($db_import_blocks)-1; $i++)
{
$text .= "<td>&nbsp;</td>";
}
$text .= "<td class='center middle'>".$frm->admin_button('import_type', 'csv', 'other',"Select")."</td></tr>";
foreach ($import_class_names as $k => $title)
{
$iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower($k)).".png";
$icon = (file_exists($iconFile)) ? "<img src='{$iconFile}' alt='' style='float:left;height:32px;width:32px;margin-right:4px'>" : "";
$text .= "<!-- $title -->
<tr><td>".$icon.$title."<div class='smalltext'>".$import_class_comment[$k]."</div></td>\n";
foreach($db_import_blocks as $key=>$val)
{
$text .= "<td class='center'>".(in_array($key,$import_class_support[$k]) ? ADMIN_TRUE_ICON : "&nbsp;")."</td>\n";
}
$text .= "
<td class='center middle'>";
$text .= $frm->admin_button('type', $k, 'other',"Select");
// $text .= $frm->admin_button('import_type', $k, 'other',"Select");
$text .= "
</td>
</tr>";
}
$text .= "
</tbody>
</table>
<div class='buttons-bar center'>
".$frm->hidden('trigger_import',1)."
</div>
</fieldset>
</form>";
echo $emessage->render().$text;
// $ns->tablerender(LAN_PLUGIN_IMPORT_NAME, $emessage->render().$text);
}
function showImportOptions($mode='csv')
{
global $text, $emessage, $csv_names, $import_class_names, $e_userclass, $db_import_blocks, $import_class_support, $import_default_prefix;
$frm = e107::getForm();
$ns = e107::getRender();
$mes = e107::getMessage();
if (class_exists($mode))
{
$mes->addDebug("Class Available: ".$mode);
$proObj = new $mode;
if($proObj->init()===FALSE)
{
return;
}
}
$message = "<strong>".LAN_CONVERT_05."</strong>";
$emessage->add($message, E_MESSAGE_WARNING);
$text = "
<form method='post' action='".e_SELF."?import_type=".$_GET['import_type']."'>
<table class='table adminform'>
<colgroup>
<col class='col-label' />
<col class='col-control' />
</colgroup>";
if($mode == "csv")
{
$text .= "
<tr>
<td>".LAN_CONVERT_07."</td>
<td><select name='csv_format' class='tbox'>\n";
foreach ($csv_names as $k => $v)
{
$s = ($current_csv == $k) ? " selected='selected'" : '';
$text .= "<option value='{$k}'{$s}>{$v}</option>\n";
}
$text .= "</select>\n
</td>
</tr>
<tr>
<td>".LAN_CONVERT_36."</td>
<td><input class='tbox' type='text' name='csv_data_file' size='30' value='{$csv_data_file}' maxlength='100' /></td>
</tr>
<tr><td>".LAN_CONVERT_17."
</td>
<td>
<input type='hidden' name='import_source' value='csv' />
<input type='checkbox' name='csv_pw_not_encrypted' value='1'".($csv_pw_not_encrypted ? " checked='checked'" : '')."/>
<span class='smallblacktext'>".LAN_CONVERT_18."</span></td>
</tr>
";
}
elseif(method_exists($proObj,"config"))
{
$ops = $proObj->config();
foreach($ops as $key=>$val)
{
$text .= "<tr>
<td>".$val['caption']."</td>
<td>".$val['html'];
$text .= (vartrue($val['help'])) ? "<div class='field-help'>".$val['help']."</div>" : "";
$text .= "</td>
</tr>\n";
}
if($proObj->sourceType)
{
$text .= "<input type='hidden' name='import_source' value='".$proObj->sourceType."' />\n";
}
}
else
{
$importType = $import_class_names[$mode];
$text .= "
<tr>
<td>$importType ".LAN_CONVERT_19."</td>
<td><input class='tbox' type='text' name='dbParamHost' size='30' value='".(varset($_POST['dbParamHost']) ? $_POST['dbParamHost'] : 'localhost')."' maxlength='100' /></td>
</tr>
<tr>
<td >$importType ".LAN_CONVERT_20."</td>
<td ><input class='tbox' type='text' name='dbParamUsername' size='30' value='".varset($_POST['dbParamUsername'])."' maxlength='100' /></td>
</tr>
<tr>
<td >$importType ".LAN_CONVERT_21."</td>
<td ><input class='tbox' type='text' name='dbParamPassword' size='30' value='".varset($_POST['dbParamPassword'])."' maxlength='100' /></td>
</tr>
<tr>
<td >$importType ".LAN_CONVERT_22."</td>
<td ><input class='tbox' type='text' name='dbParamDatabase' size='30' value='".varset($_POST['dbParamDatabase'])."' maxlength='100' /></td>
</tr>
<tr>
<td >$importType ".LAN_CONVERT_23."</td>
<td ><input class='tbox' type='text' name='dbParamPrefix' size='30' value='".(varset($_POST['dbParamPrefix']) ? $_POST['dbParamPrefix'] : $import_default_prefix[$mode])."' maxlength='100' />
<input type='hidden' name='import_source' value='db' />
</td>
</tr>";
}
if($mode != 'csv')
{
$text .= "
<tr>
<td >$importType ".LAN_CONVERT_24."</td>
<td >";
$defCheck = (count($import_class_support[$mode])==1) ? "checked='checked'" : "";
foreach ($db_import_blocks as $k => $v)
{
if(in_array($k, $import_class_support[$mode])) // display only the options supported.
{
$text .= "<input type='checkbox' name='import_block_{$k}' id='import_block_{$k}' value='1' {$defCheck} />&nbsp;".$v['message'];
$text .= "<br />";
}
}
$text .= "</td></tr>";
}
$text .= "<tr><td>".LAN_CONVERT_38."</td>
<td><input type='checkbox' name='import_delete_existing_data' value='1'".(varset($_POST['import_delete_existing_data']) ? " checked='checked'" : '')."/>
<span class='smallblacktext'>".LAN_CONVERT_39."</span></td>
</tr>";
if(varset($proObj->defaultClass) !== false)
{
$text .= "
<tr><td>".LAN_CONVERT_16."</td>
<td>";
$text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), varset($_POST['classes_select']),'main,admin,classes,matchclass, no-excludes');
$text .= "</td></tr>";
}
$action = varset($proObj->action,'do_conversion');
$text .= "</table>
<div class='buttons-bar center'>".$frm->admin_button($action,LAN_CONTINUE, 'execute').
$frm->admin_button('back',LAN_CANCEL, 'cancel')."
<input type='hidden' name='db_import_type' value='$mode' />
<input type='hidden' name='import_type' value='".$mode."' />
</div>
</form>";
// Now a little bit of JS to initialise some of the display divs etc
$temp = '';
if(varset($import_source)) { $temp .= "disp('{$import_source}');"; }
if (varset($current_db_type)) $temp .= " flagbits('{$current_db_type}');";
if (varset($temp)) $text .= "<script type=\"text/javascript\"> {$temp}</script>";
$ns -> tablerender(LAN_PLUGIN_IMPORT_NAME.SEP.$importType, $emessage->render().$text);
}
*/
@@ -1584,7 +1318,7 @@ function csv_split(&$data,$delim=',',$enveloper='')
/*
function headerjs()
{
@@ -1683,7 +1417,7 @@ function headerjs()
return $text;
}
*/

View File

@@ -19,7 +19,7 @@
// b) The array index of certain variables
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class PHPFusion_import extends base_import_class
{

View File

@@ -19,7 +19,7 @@
// b) The array index of certain variables
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class PHPNuke_import extends base_import_class
{

View File

@@ -23,7 +23,7 @@
// require_once('import_classes.php');
// require_once(__DIR__.'/../import_classes.php');
require_once('rss_import_class.php');

View File

@@ -25,7 +25,7 @@
//$import_default_prefix['coppermine_import'] = 'CPG_';
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class coppermine_import extends base_import_class
{

View File

@@ -12,7 +12,7 @@
* b) The array index of certain variables.
*/
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
/**
* Class drupal_import.

View File

@@ -26,7 +26,7 @@
//$import_default_prefix['e107_import'] = 'e107_';
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class e107_import extends base_import_class
{

View File

@@ -13,7 +13,7 @@
//$import_class_support['html_import'] = array('news','page');
//$import_default_prefix['html_import'] = '';
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class html_import extends base_import_class
{

View File

@@ -21,7 +21,7 @@
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
// Module based on ikonboard version current about September 2007 - may well support other versions
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class ikonboard_import extends base_import_class
{

View File

@@ -25,7 +25,7 @@
// Mambo and joomla have the same DB format apart from the default prefix - 'jos_' for Joomla
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class joomla_import extends base_import_class
{

View File

@@ -12,7 +12,7 @@
* $Author: secretr $
*/
// require_once('import_classes.php');
// require_once(__DIR__.'/../import_classes.php');
require_once('rss_import_class.php');
//$import_class_names['livejournal_import'] = 'LiveJournal';

View File

@@ -22,7 +22,7 @@
// Mambo and joomla have the same DB format apart from the default prefix - 'jos_' for Joomla
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class mambo_import extends base_import_class
{

View File

@@ -14,7 +14,7 @@
* $Author$
*/
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class phpbb3_import extends base_import_class
{

View File

@@ -23,7 +23,7 @@
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class rss_import extends base_import_class
{

View File

@@ -9,7 +9,7 @@
*/
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class smf_import extends base_import_class
{

View File

@@ -9,7 +9,7 @@
*/
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
/**
* @usage replace 'template' with the name of the other cms and rename this file.

View File

@@ -26,7 +26,7 @@
//$import_class_support['wordpress_import'] = array('users','news','page','links');
//$import_default_prefix['wordpress_import'] = 'wp_';
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
class wordpress_import extends base_import_class
{

View File

@@ -9,7 +9,7 @@
*/
require_once('import_classes.php');
require_once(__DIR__.'/../import_classes.php');
/**
* @usage replace 'template' with the name of the other cms and rename this file.