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

More forum work

This commit is contained in:
mcfly
2008-11-26 04:00:36 +00:00
parent ec611b995b
commit f45124fc14
5 changed files with 58 additions and 25 deletions

View File

@@ -11,12 +11,13 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum.php,v $
| $Revision: 1.4 $
| $Date: 2008-02-16 21:46:38 $
| $Revision: 1.5 $
| $Date: 2008-11-26 04:00:36 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if(!defined("e107_INIT")) {
if(!defined("e107_INIT"))
{
require_once("../../class2.php");
}
@@ -25,12 +26,10 @@ include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
require_once(e_PLUGIN.'forum/forum_class.php');
$forum = new e107forum;
if (strstr(e_QUERY, "untrack"))
if ($untrackId = varset($_REQUEST['untrack']))
{
$tmp1 = explode(".", e_QUERY);
$tmp = str_replace("-".$tmp1[1]."-", "", USERREALM);
$sql->db_Update("user", "user_realm='".$tp -> toDB($tmp, true)."' WHERE user_id='".USERID."' ");
header("location:".e_SELF."?track");
$forum->track('del', USERID, $untrackId);
header('location:'.$e107->url->getUrl('forum', 'thread', array('func' => 'track')));
exit;
}
@@ -43,11 +42,9 @@ if (e_QUERY == "mark.all.as.read")
}
//Mark all threads in specific forum as read
if (strstr(e_QUERY, 'mfar'))
if (varset($_REQUEST['mfar']))
{
$tmp = explode(".", e_QUERY);
$forum_id = intval($tmp[1]);
$forum->forum_markasread($forum_id);
$forum->forum_markasread((int)$_REQUEST['mfar']);
header("location:".e_SELF);
exit;
}

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.7 $
| $Date: 2008-11-26 03:24:51 $
| $Revision: 1.8 $
| $Date: 2008-11-26 04:00:36 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
@@ -287,20 +287,39 @@ class e107forum
}
}
function untrack($thread_id, $from)
function track($which, $uid, $threadId)
{
$thread_id = intval($thread_id);
global $sql;
$tmp = str_replace("-".$thread_id."-", "", USERREALM);
return $sql->db_Update("user", "user_realm='$tmp' WHERE user_id=".USERID);
global $e107;
$threadId = (int)$threadId;
$uid = (int)$uid;
$result = false;
switch($which)
{
case 'add':
$tmp = array();
$tmp['track_userid'] = $uid;
$tmp['track_thread'] = $threadId;
$result = $e107->sql->db_Insert('forum_track', $tmp);
unset($tmp);
break;
case 'delete':
case 'del':
$result = $e107->sql->db_Delete('forum_track', 'WHERE `track_userid` = {$uid} AND `track_thread');
break;
}
return $result;
}
function track($thread_id, $from)
/*
function track($uid, $thread_id)
{
$thread_id = intval($thread_id);
$thread_id = (int)$thread_id;
$uid = (int)$uid;
global $sql;
return $sql->db_Update("user", "user_realm='".USERREALM."-".$thread_id."-' WHERE user_id=".USERID);
}
*/
function forum_get($forum_id)
{

View File

@@ -58,9 +58,9 @@ CREATE TABLE forum_post (
CREATE TABLE forum_track (
`track_userid` int(10) unsigned NOT NULL,
`track_threadid` int(10) unsigned NOT NULL,
`track_thread` int(10) unsigned NOT NULL,
PRIMARY KEY (`track_userid`,`track_threadid`),
KEY `track_userid` (`track_userid`),
KEY `track_threadid` (`track_threadid`)
KEY `track_thread` (`track_thread`)
) Type=MyISAM;

View File

@@ -1,11 +1,16 @@
<?php
// $Id: forum.php,v 1.1 2008-11-26 03:24:51 mcfly_e107 Exp $
// $Id: forum.php,v 1.2 2008-11-26 04:00:36 mcfly_e107 Exp $
function url_forum_forum($parms)
{
switch($parms['func'])
{
case 'view':
return e_PLUGIN."forum/viewforum.php?{$parms['id']}";
return e_PLUGIN_ABS."forum/viewforum.php?{$parms['id']}";
break;
case 'track':
return e_PLUGIN_ABS.'forum/forum.php?track';
break;
}
}

View File

@@ -0,0 +1,12 @@
<?php
// $Id: thread.php,v 1.1 2008-11-26 04:00:36 mcfly_e107 Exp $
function url_forum_thread($parms)
{
switch($parms['func'])
{
case 'track':
return e_PLUGIN_ABS.'forum/forum.php?track';
break;
}
}