mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Forum now generates SEF URLs during upgrade. Forum tools reinstated. Additional debug options added.
This commit is contained in:
@@ -20,17 +20,17 @@ if (!getperms('P'))
|
||||
e107::includeLan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/English_admin.php');
|
||||
e107::lan('forum','', 'front');
|
||||
|
||||
$legacy = false;
|
||||
|
||||
|
||||
if(E107_DEBUG_LEVEL == 0)
|
||||
if(E107_DEBUG_LEVEL > 0 && $legacy == true)
|
||||
{
|
||||
define('NEW_FORUMADMIN', true);
|
||||
define('OLD_FORUMADMIN', true);
|
||||
//e107::getMessage()->addwarning("Experimental code now active. Using this page in debug mode active could break your forum configuration.");
|
||||
}
|
||||
|
||||
// Generated e107 Plugin Admin Area
|
||||
|
||||
if(deftrue('NEW_FORUMADMIN'))
|
||||
if(!deftrue('OLD_FORUMADMIN'))
|
||||
{
|
||||
|
||||
class forum_admin extends e_admin_dispatcher
|
||||
@@ -89,6 +89,18 @@ if(deftrue('NEW_FORUMADMIN'))
|
||||
);
|
||||
|
||||
protected $menuTitle = 'Forum';
|
||||
|
||||
|
||||
function init()
|
||||
{
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$this->adminMenu['opt3'] = array('divider'=>true);
|
||||
$this->adminMenu['main/update'] = array('caption'=>"Redo v1.x Forum Upgrade", 'perm'=>0, 'uri'=>'{e_PLUGIN}forum/forum_update.php');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -691,10 +703,136 @@ if(deftrue('NEW_FORUMADMIN'))
|
||||
|
||||
|
||||
|
||||
function toolsPageProcess()
|
||||
{
|
||||
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$fList = array();
|
||||
|
||||
if(isset($_POST['tools']))
|
||||
{
|
||||
$msg = '';
|
||||
if(isset($_POST['forum_all']))
|
||||
{
|
||||
$fList[]='all';
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(array_keys($_POST['forumlist']) as $k)
|
||||
{
|
||||
$fList[] = $k;
|
||||
}
|
||||
}
|
||||
foreach($fList as $fid)
|
||||
{
|
||||
if(isset($_POST['counts']))
|
||||
{
|
||||
$this->forumObj->forumUpdateCounts($fid, $_POST['counts_threads']);
|
||||
$msg .= FORLAN_167.": $fid <br />";
|
||||
}
|
||||
if(isset($_POST['lastpost']))
|
||||
{
|
||||
$with_threads = (!empty($_POST['lastpost_nothread'])) ? FALSE : TRUE;
|
||||
$this->forumObj->forumUpdateLastpost('forum', $fid, $with_threads);
|
||||
$msg .= FORLAN_168.": $fid <br />";
|
||||
}
|
||||
}
|
||||
if(isset($_POST['userpostcounts']))
|
||||
{
|
||||
$ue = e107::getUserExt();
|
||||
|
||||
$list = $this->forumObj->getUserCounts();
|
||||
foreach($list as $uid => $cnt)
|
||||
{
|
||||
$ue->user_extended_setvalue($uid, 'user_plugin_forum_posts', $cnt, 'int');
|
||||
}
|
||||
$msg .= FORLAN_169.' <br />';
|
||||
}
|
||||
|
||||
$mes->addSuccess($msg);
|
||||
// $ns->tablerender($caption, $mes->render().$text);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//TODO Add SEF-url generation for forum and threads where missing.
|
||||
function toolsPage()
|
||||
{
|
||||
return "Coming Soon!";
|
||||
$sql = e107::getDb();
|
||||
$ns = e107::getRender();
|
||||
$tp = e107::getParser();
|
||||
$frm = e107::getForm();
|
||||
|
||||
$this->toolsPageProcess();
|
||||
|
||||
$txt = "
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||
<table class='table adminlist'>
|
||||
<colgroup span='3'>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
<col class='col-control' style='width:50%' />
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>".FORLAN_156."</td>
|
||||
|
||||
<td colspan='2'>
|
||||
";
|
||||
if($sql->select("forum", "*", "1 ORDER BY forum_order"))
|
||||
{
|
||||
$fList = $sql->db_getList();
|
||||
foreach($fList as $f)
|
||||
{
|
||||
$key = 'forumlist['.$f['forum_id'].']';
|
||||
$txt .= $frm->checkbox($key, 1, false, $tp->toHTML($f['forum_name']));
|
||||
// $txt .= "<input type='checkbox' name='forumlist[{$f['forum_id']}]' value='1' /> ".$tp->toHTML($f['forum_name'])."<br />";
|
||||
}
|
||||
$txt .= "<hr />";
|
||||
$txt .= $frm->checkbox('forum_all', 1, false, LAN_PLUGIN_FORUM_ALLFORUMS);
|
||||
// $txt .= "<input type='checkbox' name='forum_all' value='1' /> <strong>".LAN_PLUGIN_FORUM_ALLFORUMS."</strong>";
|
||||
}
|
||||
|
||||
|
||||
//TODO LAN - see below
|
||||
$txt .= "
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".FORLAN_158."</td>
|
||||
|
||||
<td>".$frm->checkbox('lastpost', 1, false, LAN_ACTIVE).
|
||||
"</td><td>".
|
||||
$frm->select('lastpost_nothread', array(0=>"Forums and Threads", 1=>"Forums Only"))."
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".FORLAN_161."</td>
|
||||
|
||||
<td>".$frm->checkbox('counts', 1, false, LAN_ACTIVE).
|
||||
"</td><td>".
|
||||
$frm->checkbox('counts_threads', 1, false, FORLAN_182)."
|
||||
<span class='text-warning'>".FORLAN_183."</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>".FORLAN_163."</td>
|
||||
|
||||
<td colspan='2'>".$frm->checkbox('userpostcounts',1, false, LAN_ACTIVE)."</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('tools', LAN_GO, 'submit')."
|
||||
</div>
|
||||
</form>
|
||||
";
|
||||
|
||||
return $txt;
|
||||
// $ns->tablerender(FORLAN_166, $txt);
|
||||
|
||||
|
||||
}
|
||||
|
@@ -248,8 +248,6 @@ function step3()
|
||||
return;
|
||||
}
|
||||
|
||||
require_once (e_HANDLER . 'user_extended_class.php');
|
||||
$ue = new e107_user_extended;
|
||||
|
||||
$fieldList = array(
|
||||
'plugin_forum_posts' => EUF_INTEGER,
|
||||
@@ -260,7 +258,7 @@ function step3()
|
||||
foreach ($fieldList as $fieldName => $fieldType)
|
||||
{
|
||||
|
||||
$result = $ue -> user_extended_add_system($fieldName, $fieldType);
|
||||
$result = e107::getUserExt()->user_extended_add_system($fieldName, $fieldType);
|
||||
|
||||
if ($result === true)
|
||||
{
|
||||
@@ -280,7 +278,7 @@ function step3()
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "
|
||||
$text = "
|
||||
<form method='post' action='" . e_SELF . "?step=4'>
|
||||
<input class='btn btn-success' type='submit' name='nextStep[4]' value='Proceed to step 4' />
|
||||
</form>
|
||||
@@ -468,6 +466,9 @@ function step5()
|
||||
$tmp = $forum;
|
||||
$tmp['forum_threadclass'] = $tmp['forum_postclass'];
|
||||
$tmp['forum_options'] = '_NULL_';
|
||||
$tmp['forum_sef'] = eHelper::title2sef($forum['forum_name'],'dashl');
|
||||
|
||||
|
||||
// $tmp['_FIELD_TYPES'] = $ftypes['_FIELD_TYPES'];
|
||||
if ($sql -> insert('forum_new', $tmp))
|
||||
{
|
||||
@@ -489,10 +490,10 @@ function step5()
|
||||
</ul>
|
||||
");
|
||||
|
||||
$result = $sql -> gen('RENAME TABLE `#forum` TO `#forum_old` ') ? e_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
$result = $sql -> gen('RENAME TABLE `#forum` TO `#forum_old` ') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
$mes -> add("Renaming forum to forum_old", $result);
|
||||
|
||||
$result = $sql -> gen('RENAME TABLE `#forum_new` TO `#forum` ') ? e_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
$result = $sql -> gen('RENAME TABLE `#forum_new` TO `#forum` ') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
$mes -> add("Renaming forum_new to forum", $result);
|
||||
|
||||
$text = "
|
||||
@@ -634,7 +635,7 @@ function step7()
|
||||
|
||||
// var_dump($counts);
|
||||
|
||||
$text .= "
|
||||
$text = "
|
||||
Successfully recalculated forum posts for " . count($counts) . " users.
|
||||
<br /><br />
|
||||
<form method='post' action='" . e_SELF . "?step=8'>
|
||||
@@ -1414,6 +1415,7 @@ class forumUpgrade
|
||||
* thread_lastuser_anon
|
||||
* thread_total_replies
|
||||
* thread_options
|
||||
* thread_sef
|
||||
*/
|
||||
|
||||
$detected = mb_detect_encoding($post['thread_name']); // 'ISO-8859-1'
|
||||
@@ -1447,6 +1449,8 @@ class forumUpgrade
|
||||
// $thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent
|
||||
// double entities
|
||||
|
||||
$thread['thread_sef'] = eHelper::title2sef($threadName,'dashl');
|
||||
|
||||
$result = e107::getDb() -> insert('forum_thread', $thread);
|
||||
return $result;
|
||||
}
|
||||
@@ -1720,13 +1724,16 @@ function forum_update_adminmenu()
|
||||
$var[13]['divider'] = true;
|
||||
|
||||
$var[14]['text'] = 'Reset';
|
||||
$var[14]['link'] = e_SELF . "?reset";
|
||||
$var[14]['link'] = e_SELF . "?reset";
|
||||
|
||||
$var[15]['text'] = 'Reset to 6';
|
||||
$var[15]['link'] = e_SELF . "?step=6&reset=6";
|
||||
|
||||
$var[16]['text'] = 'Reset to 7';
|
||||
$var[16]['link'] = e_SELF . "?step=7&reset=7";
|
||||
|
||||
$var[15]['text'] = 'Reset to 7';
|
||||
$var[15]['link'] = e_SELF . "?step=7&reset=7";
|
||||
|
||||
$var[16]['text'] = 'Reset to 10';
|
||||
$var[16]['link'] = e_SELF . "?step=10&reset=10";
|
||||
$var[17]['text'] = 'Reset to 10';
|
||||
$var[17]['link'] = e_SELF . "?step=10&reset=10";
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user