1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Code cleanup

This commit is contained in:
Cameron
2019-05-26 17:05:29 -07:00
parent f1081c2b21
commit eb6401385e
8 changed files with 510 additions and 1385 deletions

View File

@@ -455,8 +455,8 @@ class e107forum
/**
* get user ids with moderator permissions for the given $forumId
* @param $forumId id of a forum
* @return an array with user ids how have moderator permissions for the $forumId
* @param int $forumId id of a forum
* @return array with user ids how have moderator permissions for the $forumId
*/
public function getModeratorUserIdsByForumId($forumId)
{
@@ -980,7 +980,7 @@ class e107forum
}
$this->threadMarkAsRead($newThreadId);
$threadInfo['thread_sef'] = $this->getThreadsef($threadInfo);
$threadInfo['thread_sef'] = $this->getThreadSef($threadInfo);
$triggerData = $info['data'];
$triggerData['thread_id'] = $newThreadId;
@@ -1377,45 +1377,6 @@ class e107forum
// Empty the post_attachments field for this post in the database (prevents loop when deleting entire thread)
$sql->update("forum_post", "post_attachments = NULL WHERE post_id = ".$id);
/* Old code when attachments were still stored in plugin folder.
Left for review but may be deleted in future.
foreach($attachments as $k => $a)
{
$info = explode('*', $a);
if('' == $f || $info[1] == $f)
{
$fname = e_PLUGIN."forum/attachments/{$info[1]}";
@unlink($fname);
//If attachment is an image and there is a thumb, remove it
if('img' == $info[0] && $info[2])
{
$fname = e_PLUGIN."forum/attachments/thumb/{$info[2]}";
@unlink($fname);
}
}
unset($attachments[$k]);
}
$tmp = array();
if(count($attachments))
{
$tmp['post_attachments'] = implode(',', $attachments);
}
else
{
$tmp['post_attachments'] = '_NULL_';
}
$info = array();
$info['data'] = $tmp;
$info['_FILE_TYPES']['post_attachments'] = 'array';
$info['WHERE'] = 'post_id = '.$id;
$sql->update('forum_post', $info);
*/
}
}
@@ -1747,7 +1708,7 @@ class e107forum
* Get a list of forum IDs that have unread threads.
* If a forum is a subforum, also ensure the parent is in the list.
*
* @return type description
* @return array|bool description
* @access public
*/
function forumGetUnreadForums()
@@ -2215,7 +2176,7 @@ class e107forum
$this->forumUpdateCounts($fid);
}
return FORLAN_8." ( ".$thread_count." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
return FORLAN_8." ( ".count($threadList)." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
// return FORLAN_8." ( ".count($threadList)." ".FORLAN_92.", ".$reply_count." ".FORLAN_93." )";
}
else
{
@@ -2357,7 +2318,10 @@ class e107forum
$threadInfo['thread_id'] = intval($threadInfo['thread_id']);
$search = array('{THREAD_TITLE}', '{THREAD_HREF}');
$replace = array(vartrue($threadInfo['thread_name']), ''); // $thread->threadInfo - no reference found
$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, varset($FORUM_CRUMB['thread']['value']));
$FORUM_CRUMB['fieldlist'] = 'sitename,forums,parent,subparent,forum,thread';
@@ -2416,13 +2380,12 @@ class e107forum
if($forumInfo['forum_sub'])
{
$breadcrumb[] = array('text'=> ltrim($forumInfo['sub_parent'], '*') , 'url'=> e107::url('forum','forum', array('forum_sef'=> $forumInfo['parent_sef'])));
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (defset('e_PAGE') !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
}
else
{
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (e_PAGE !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
$breadcrumb[] = array('text'=>ltrim($forumInfo['forum_name'], '*') , 'url'=> (defset('e_PAGE') !='forum_viewforum.php') ? e107::url('forum', 'forum', $forumInfo) : null);
}
if(vartrue($forumInfo['thread_name']))