mirror of
https://github.com/e107inc/e107.git
synced 2025-07-23 16:01:39 +02:00
Fixes #1056 - Forum rules and statistics links added back to template and reworked for bootstrap. thread_sef removed from forum_thread database table and now generated on the fly. More testing required.
This commit is contained in:
@@ -25,6 +25,18 @@ class forum_url // plugin-folder + '_url'
|
||||
{
|
||||
$config = array();
|
||||
|
||||
$config['rules'] = array(
|
||||
'regex' => '^forum/rules/?',
|
||||
'sef' => 'forum/rules',
|
||||
'redirect' => '{e_PLUGIN}forum/forum.php?f=rules',
|
||||
);
|
||||
|
||||
$config['stats'] = array(
|
||||
'regex' => '^forum/stats/?',
|
||||
'sef' => 'forum/stats',
|
||||
'redirect' => '{e_PLUGIN}forum/forum_stats.php',
|
||||
);
|
||||
|
||||
$config['post'] = array(
|
||||
'regex' => '^forum/post/?',
|
||||
'sef' => 'forum/post/',
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#forum-viewtopic li.forum-viewtopic-post:nth-child(odd) { background: #F5F5F5 }
|
||||
#forum-viewtopic li ul.thumbnails { margin-top:15px }
|
||||
#forum-viewtopic li img.user-avatar { margin-bottom:10px; display:inline-block }
|
||||
|
||||
#forum, #forum-stats, #forum-rules { min-height: 500px; }
|
||||
|
||||
.forum-attachment-file { margin-top:15px; }
|
||||
.forum-user-combo { padding-bottom:5px }
|
||||
.forum-user-combo { padding-bottom:5px }
|
||||
|
@@ -53,6 +53,7 @@ if(isset($_GET['f']))
|
||||
|
||||
case 'rules':
|
||||
include_once(HEADERF);
|
||||
|
||||
forum_rules('show');
|
||||
include_once(FOOTERF);
|
||||
exit;
|
||||
@@ -74,6 +75,7 @@ $fVars->NEWIMAGE = IMAGE_new_small;
|
||||
$fVars->TRACKTITLE = LAN_FORUM_0073;
|
||||
|
||||
$rules_text = forum_rules('check');
|
||||
|
||||
$fVars->USERINFO = "<a href='".e_BASE."top.php?0.top.forum.10'>".LAN_FORUM_0010."</a> | <a href='".e_BASE."top.php?0.active'>".LAN_FORUM_0011."</a>";
|
||||
if(USER)
|
||||
{
|
||||
@@ -83,10 +85,27 @@ if(USER)
|
||||
$fVars->USERINFO .= " | <a href='".e_PLUGIN."forum/forum_uploads.php'>".LAN_FORUM_0015."</a>";
|
||||
}
|
||||
}
|
||||
if($rules_text != '')
|
||||
if(!empty($rules_text))
|
||||
{
|
||||
$fVars->USERINFO .= " | <a href='".$e107->url->create('forum/forum/rules')."'>".LAN_FORUM_0016.'</a>';
|
||||
$fVars->USERINFO .= " | <a href='".e107::url('forum','rules')."'>".LAN_FORUM_0016.'</a>';
|
||||
}
|
||||
|
||||
|
||||
// v2.x --------------------
|
||||
$uInfo = array();
|
||||
$uInfo[0] = "<a href='".e107::url('forum','stats')."'>".LAN_FORUM_6013.'</a>';
|
||||
|
||||
if(!empty($rules_text))
|
||||
{
|
||||
$uInfo[1] = "<a href='".e107::url('forum','rules')."'>".LAN_FORUM_0016.'</a>';
|
||||
}
|
||||
|
||||
$fVars->USERINFOX = implode(" | ",$uInfo);
|
||||
// -----------
|
||||
|
||||
|
||||
|
||||
|
||||
$total_topics = $sql->count("forum_thread", "(*)");
|
||||
$total_replies = $sql->count("forum_post", "(*)");
|
||||
$total_members = $sql->count("user");
|
||||
@@ -562,7 +581,23 @@ function forum_rules($action = 'check')
|
||||
{
|
||||
$rules_text = LAN_FORUM_0072;
|
||||
}
|
||||
e107::getRender()->tablerender(LAN_FORUM_0016, "<div style='text-align:center'>{$rules_text}</div>", array('forum', 'forum_rules'));
|
||||
|
||||
$text = '';
|
||||
|
||||
if(deftrue('BOOTSTRAP'))
|
||||
{
|
||||
$breadarray = array(
|
||||
array('text'=> e107::pref('forum','title', LAN_PLUGIN_FORUM_NAME), 'url' => e107::url('forum','index') ),
|
||||
array('text'=>LAN_FORUM_0016, 'url'=>null)
|
||||
);
|
||||
|
||||
$text = e107::getForm()->breadcrumb($breadarray);
|
||||
}
|
||||
|
||||
$text .= "<div id='forum-rules'>".$rules_text."</div>";
|
||||
$text .= "<div class='center'>".e107::getForm()->pagination(e107::url('forum','index'), LAN_BACK)."</div>";
|
||||
|
||||
e107::getRender()->tablerender(LAN_FORUM_0016, $text, array('forum', 'forum_rules'));
|
||||
}
|
||||
|
||||
?>
|
@@ -375,7 +375,7 @@ if(!deftrue('OLD_FORUMADMIN'))
|
||||
|
||||
public function beforeUpdate($new_data, $old_data, $id)
|
||||
{
|
||||
if(empty($new_data['forum_sef']))
|
||||
if(empty($new_data['forum_sef']) && !empty($new_data['forum_name']))
|
||||
{
|
||||
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']);
|
||||
}
|
||||
|
@@ -747,7 +747,7 @@ class e107forum
|
||||
$info = array();
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
|
||||
|
||||
$threadInfo['thread_sef'] = eHelper::title2sef($threadInfo['thread_name']);
|
||||
// $threadInfo['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'],'dashl');
|
||||
|
||||
$info['data'] = $threadInfo;
|
||||
|
||||
@@ -758,6 +758,8 @@ class e107forum
|
||||
$postInfo['post_thread'] = $newThreadId;
|
||||
$newPostId = $this->postAdd($postInfo, false);
|
||||
$this->threadMarkAsRead($newThreadId);
|
||||
$threadInfo['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'],'dashl');
|
||||
|
||||
return array('postid' => $newPostId, 'threadid' => $newThreadId, 'threadsef'=>$threadInfo['thread_sef']);
|
||||
}
|
||||
return false;
|
||||
@@ -783,7 +785,7 @@ class e107forum
|
||||
else
|
||||
{
|
||||
//Replace title
|
||||
$threadTitle = ", thread_name = '{$threadTitle}', thread_sef='".eHelper::title2sef($threadTitle,'dashl')."' ";
|
||||
$threadTitle = ", thread_name = '{$threadTitle}' "; // , thread_sef='".eHelper::title2sef($threadTitle,'dashl')."' ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,7 +810,7 @@ class e107forum
|
||||
function threadUpdate($threadId, $threadInfo)
|
||||
{
|
||||
$info = array();
|
||||
$threadInfo['thread_sef'] = eHelper::title2sef($threadInfo['thread_name']);
|
||||
// $threadInfo['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'],'dashl');
|
||||
|
||||
$info['data'] = $threadInfo;
|
||||
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
|
||||
@@ -878,6 +880,9 @@ class e107forum
|
||||
{
|
||||
$tmp['thread_options'] = unserialize($tmp['thread_options']);
|
||||
}
|
||||
|
||||
$tmp['thread_sef'] = eHelper::title2sef($tmp['thread_name'],'dashl');
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
}
|
||||
@@ -898,7 +903,7 @@ class e107forum
|
||||
if('post' === $start)
|
||||
{
|
||||
$qry = '
|
||||
SELECT u.user_name, t.thread_active, t.thread_datestamp, t.thread_name, t.thread_sef, t.thread_user, t.thread_id, p.* FROM `#forum_post` AS p
|
||||
SELECT u.user_name, t.thread_active, t.thread_datestamp, t.thread_name, t.thread_user, t.thread_id, p.* FROM `#forum_post` AS p
|
||||
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread
|
||||
LEFT JOIN `#user` AS u ON u.user_id = p.post_user
|
||||
WHERE p.post_id = '.$id;
|
||||
@@ -926,6 +931,7 @@ class e107forum
|
||||
$ret = array();
|
||||
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
|
||||
$ret[] = $row;
|
||||
}
|
||||
}
|
||||
@@ -1591,6 +1597,7 @@ class e107forum
|
||||
{
|
||||
while ($row = $sql->fetch(MYSQL_ASSOC))
|
||||
{
|
||||
// $row['thread_sef'] = eHelper::title2sef($row['thread_name']);
|
||||
$ret[] = $row;
|
||||
}
|
||||
}
|
||||
@@ -1604,7 +1611,7 @@ class e107forum
|
||||
$sql = e107::getDb();
|
||||
$id = (int)$id;
|
||||
$qry = "
|
||||
SELECT p.post_user, p.post_id, p.post_user_anon, p.post_datestamp, p.post_thread, t.thread_sef, u.user_name FROM `#forum_post` AS p
|
||||
SELECT p.post_user, p.post_id, p.post_user_anon, p.post_datestamp, p.post_thread, t.thread_name, u.user_name FROM `#forum_post` AS p
|
||||
LEFT JOIN `#forum_thread` AS t ON p.post_thread = t.thread_id
|
||||
LEFT JOIN `#user` AS u ON u.user_id = p.post_user
|
||||
WHERE p.post_thread = {$id}
|
||||
@@ -1612,7 +1619,9 @@ class e107forum
|
||||
";
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
return $sql->fetch(MYSQL_ASSOC);
|
||||
$row = $sql->fetch(MYSQL_ASSOC);
|
||||
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
|
||||
return $row;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1635,7 +1644,7 @@ class e107forum
|
||||
|
||||
|
||||
$qry = "
|
||||
SELECT t.thread_id, t.thread_sef, f.forum_id, f.forum_sef FROM `#forum_thread` AS t
|
||||
SELECT t.thread_id, t.thread_name, f.forum_id, f.forum_sef FROM `#forum_thread` AS t
|
||||
LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id
|
||||
WHERE t.thread_forum_id = $forumId
|
||||
AND t.thread_lastpost {$dir} $lastpost
|
||||
@@ -1649,6 +1658,7 @@ class e107forum
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
$row = $sql->fetch();
|
||||
$row['thread_sef'] = eHelper::title2sef($row['thread_name'],'dashl');
|
||||
// e107::getMessage()->addInfo(ucfirst($which).print_a($row,true));
|
||||
return $row;
|
||||
// return $row['thread_id'];
|
||||
|
@@ -824,7 +824,9 @@ class forum_post_handler
|
||||
$newThreadId = $postResult['threadid'];
|
||||
|
||||
$this->data['thread_id'] = $newThreadId;
|
||||
$this->data['thread_sef'] = $postResult['threadsef'];
|
||||
// $this->data['thread_sef'] = $postResult['threadsef'];
|
||||
$this->data['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'],'dashl');
|
||||
|
||||
|
||||
|
||||
if($_POST['email_notify'])
|
||||
|
@@ -59,6 +59,11 @@ class forum_setup
|
||||
{
|
||||
return true; // true to trigger an upgrade alert, and false to not.
|
||||
}
|
||||
|
||||
if(e107::getDb()->field('forum_thread', 'thread_sef'))
|
||||
{
|
||||
e107::getDb()->gen("ALTER TABLE `#forum_thread` DROP `thread_sef` ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,6 @@ CREATE TABLE forum_thread (
|
||||
`thread_lastuser_anon` varchar(30) default NULL,
|
||||
`thread_total_replies` int(10) unsigned NOT NULL default '0',
|
||||
`thread_options` text,
|
||||
`thread_sef` varchar(250) default NULL,
|
||||
PRIMARY KEY (`thread_id`),
|
||||
KEY `thread_forum_id` (`thread_forum_id`),
|
||||
KEY `thread_sticky` (`thread_sticky`),
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -469,6 +469,8 @@ function parse_thread($thread_info)
|
||||
|
||||
$tVars->LASTPOSTUSER = $thread_info['lastpost_username']; // $lastpost_name;
|
||||
|
||||
$thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
|
||||
|
||||
$urlData = array('forum_sef'=>$thread_info['forum_sef'], 'thread_id'=>$thread_info['thread_id'],'thread_sef'=>$thread_info['thread_sef']);
|
||||
$url = e107::url('forum', 'topic', $urlData);
|
||||
$url .= (strpos($url,'?')!==false) ? '&' : '?';
|
||||
@@ -534,6 +536,7 @@ function parse_thread($thread_info)
|
||||
|
||||
// $url = e107::getUrl()->create('forum/thread/view', array('id' => $threadId, 'name' => $thread_name));
|
||||
|
||||
$thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
|
||||
$url = e107::url('forum','topic', $thread_info);
|
||||
$tVars->THREADNAME = "<a {$title} href='".$url."'>{$thread_name}</a>";
|
||||
|
||||
@@ -793,6 +796,7 @@ function fpages($thread_info, $replies)
|
||||
global $forum;
|
||||
|
||||
$pages = ceil(($replies)/$forum->prefs->get('postspage'));
|
||||
$thread_info['thread_sef'] = eHelper::title2sef($thread_info['thread_name'],'dashl');
|
||||
$urlparms = $thread_info;
|
||||
|
||||
if ($pages > 1)
|
||||
|
@@ -86,7 +86,7 @@ $FORUM_TEMPLATE['main-start'] = "{FORUM_BREADCRUMB}
|
||||
{SEARCH}
|
||||
</div>
|
||||
</div>
|
||||
<div >
|
||||
<div id='forum' >
|
||||
<table class='table table-striped table-bordered table-hover'>
|
||||
<colgroup>
|
||||
<col style='width:3%' />
|
||||
@@ -115,7 +115,8 @@ $FORUM_TEMPLATE['main-forum'] = "<tr>
|
||||
<td class='hidden-xs'><small>{LASTPOSTUSER} {LASTPOSTDATE}</small></td>
|
||||
</tr>";
|
||||
|
||||
$FORUM_TEMPLATE['main-end'] = "</table></div>";
|
||||
$FORUM_TEMPLATE['main-end'] = "</table><div class='center'><small>{USERINFOX}</small></div></div>";
|
||||
|
||||
/*
|
||||
$FORUM_TEMPLATE['main-end'] .= "
|
||||
|
||||
|
32
top.php
32
top.php
@@ -72,18 +72,18 @@ if ($action == 'active')
|
||||
{$from}, {$view}
|
||||
";
|
||||
|
||||
if ($sql->db_Select_gen($qry))
|
||||
if ($sql->gen($qry))
|
||||
{
|
||||
$text = "<div style='text-align:center'>\n<table style='width:auto' class='fborder'>\n";
|
||||
$gen = e107::getDateConvert();
|
||||
$text = "<div>\n<table style='width:auto' class='table fborder'>\n";
|
||||
$gen = e107::gethateConvert();
|
||||
|
||||
$text .= "<tr>
|
||||
<td style='width:5%' class='forumheader'> </td>
|
||||
<td style='width:45%' class='forumheader'>".LAN_1."</td>
|
||||
<td style='width:15%; text-align:center' class='forumheader'>".LAN_2."</td>
|
||||
<td style='width:5%; text-align:center' class='forumheader'>".LAN_3."</td>
|
||||
<td style='width:5%; text-align:center' class='forumheader'>".LAN_4."</td>
|
||||
<td style='width:25%; text-align:center' class='forumheader'>".LAN_5."</td>
|
||||
<th style='width:5%' class='forumheader'> </th>
|
||||
<th style='width:45%' class='forumheader'>".LAN_1."</th>
|
||||
<th style='width:15%; text-align:center' class='forumheader'>".LAN_2."</th>
|
||||
<th style='width:5%; text-align:center' class='forumheader'>".LAN_3."</th>
|
||||
<th style='width:5%; text-align:center' class='forumheader'>".LAN_4."</th>
|
||||
<th style='width:25%; text-align:center' class='forumheader'>".LAN_5."</th>
|
||||
</tr>\n";
|
||||
|
||||
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
@@ -155,17 +155,17 @@ if ($action == 'top')
|
||||
";
|
||||
// $top_forum_posters = $sql->db_Select("user", "*", "`user_forums` > 0 ORDER BY user_forums DESC LIMIT ".$from.", ".$view."");
|
||||
$text = "
|
||||
<div style='text-align:center'>
|
||||
<table style='width:95%' class='fborder'>
|
||||
<div>
|
||||
<table style='width:95%' class='table table-striped fborder'>
|
||||
<tr>
|
||||
<td style='width:10%; text-align:center' class='forumheader3'> </td>
|
||||
<td style='width:50%' class='forumheader3'>".TOP_LAN_1."</td>
|
||||
<td style='width:10%; text-align:center' class='forumheader3'>".TOP_LAN_2."</td>
|
||||
<td style='width:30%; text-align:center' class='forumheader3'>".TOP_LAN_6."</td>
|
||||
<th style='width:10%; text-align:center' class='forumheader3'> </th>
|
||||
<th style='width:50%' class='forumheader3'>".TOP_LAN_1."</th>
|
||||
<th style='width:10%; text-align:center' class='forumheader3'>".TOP_LAN_2."</th>
|
||||
<th style='width:30%; text-align:center' class='forumheader3'>".TOP_LAN_6."</th>
|
||||
</tr>\n";
|
||||
$counter = 1 + $from;
|
||||
$sql2 = e107::getDb('sql2');
|
||||
if ($sql2->db_Select_gen($qry))
|
||||
if ($sql2->gen($qry))
|
||||
{
|
||||
while ($row = $sql2->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
|
Reference in New Issue
Block a user