function threadsubscribe($where = '') { global $wgOut, $awc, $awc_tables, $tplt; $thread_tools = new awcs_forum_thread_list_tools(); $tplt->add_tplts(array("'memcp_recent_header'", "'memcp_recent_row'", "'memcp_recent_close'", "'postblocks_threadlisting'"), true); $words = array(); $words['thread_title'] = get_awcsforum_word('thread_title'); $words['word_replies'] = get_awcsforum_word('word_replies'); $words['last_action'] = get_awcsforum_word('last_action'); $words['thread_title_started_by'] = get_awcsforum_word('thread_title_started_by'); $words['delete'] = get_awcsforum_word('delete'); Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('mem_subscriptionthread')); if (function_exists('bcmod')) { $row_class = 1; } else { $row_class = 0; } $html = '<form action="' . awc_url . 'member_options/delete_tsub" method="post" enctype="multipart/form-data">'; $html .= $tplt->phase($words, '', 'memcp_recent_header', true); $dbr = wfGetDB(DB_SLAVE); if ($where == 'list') { Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_subscribe_memcp'), true); $sql = "SELECT w.wtcht_todo, t.t_postid, t.t_id, t.t_topics, t.t_lastdate, t.t_name, t.t_starterid, t.t_starter, t.t_lastuser, t.t_lastuserid\r\r\n FROM {$awc_tables['awc_f_watchthreads']} w, {$awc_tables['awc_f_threads']} t \r\r\n WHERE w.wtcht_todo='list' AND t.t_id=w.wtcht_thread_id AND w.wtcht_mem_id=" . $this->m_id . " ORDER BY t.t_lastdate DESC"; } elseif ($where == 'email') { Set_AWC_Forum_BreadCrumbs(get_awcsforum_word('word_subscribe_email'), true); $sql = "SELECT w.wtcht_todo, t.t_postid, t.t_id, t.t_topics, t.t_lastdate, t.t_name, t.t_starterid, t.t_starter, t.t_lastuser, t.t_lastuserid\r\r\n FROM {$awc_tables['awc_f_watchthreads']} w, {$awc_tables['awc_f_threads']} t \r\r\n WHERE w.wtcht_todo='email' AND t.t_id=w.wtcht_thread_id AND w.wtcht_mem_id=" . $this->m_id . " ORDER BY t.t_lastdate DESC"; } else { Set_AWC_Forum_BreadCrumbs('', true); $sql = "SELECT w.wtcht_todo, t.t_postid, t.t_id, t.t_topics, t.t_lastdate, t.t_name, t.t_starterid, t.t_starter, t.t_lastuser, t.t_lastuserid\r\r\n FROM {$awc_tables['awc_f_watchthreads']} w, {$awc_tables['awc_f_threads']} t \r\r\n WHERE t.t_id=w.wtcht_thread_id AND w.wtcht_mem_id=" . $this->m_id . " ORDER BY t.t_lastdate DESC"; } $res = $dbr->query($sql); $c = 0; while ($r = $dbr->fetchObject($res)) { $info['t_id'] = $r->t_id; $info['t_name'] = awcsforum_funcs::awc_html_entity_decode($r->t_name); $info['t_topics'] = $r->t_topics; $info['t_starter'] = $r->t_starter; $info['t_starterid'] = $r->t_starterid; $info['last'] = '<a href="' . awc_url . 'last_post/' . $r->t_id . '">' . awcsforum_funcs::convert_date($r->t_lastdate, "s") . '</a>'; /* if($awcUser->guest == false){ $info['NewPost'] = awcs_forum_CheckIfThreadIsNew($r->t_id, $r->t_lastdate); } else { $info['NewPost'] = null; } */ $info['NewPost'] = $thread_tools->new_thread_check($r->t_id, $r->t_lastdate); $info['url'] = awc_url . 'st/' . $r->t_id; if ($where == 'email' or $where == 'list') { $info['wtcht_todo'] = null; } else { $info['wtcht_todo'] = $r->wtcht_todo; } $thread_tools->link = awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $info['t_jump'] = $thread_tools->GetThreadPostLimit(); $c++; if ($row_class) { $info['row_class'] = 'thread_rows' . bcmod($c, '2'); } else { $info['row_class'] = 'thread_rows'; } $html .= $tplt->phase($words, $info, 'memcp_recent_row'); } $dbr->freeResult($res); $tplt->kill('memcp_recent_row'); $html .= $tplt->phase($words, '', 'memcp_recent_close', true); $html .= '</form>'; self::display_memcp($html); }
function GetForumDisplayInfo($info) { global $awc, $wgOut, $awcs_forum_config, $str_len, $forum, $perm_sql; $thread_tools = new awcs_forum_thread_list_tools(); if ($info['both']) { $info['classThreadtitle'] = 'class="' . $info['classThreadtitle'] . '" id="' . $info['idThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['classReplies'] . '" id="' . $info['idReplies'] . '"'; $info['classViews'] = 'class="' . $info['classViews'] . '" id="' . $info['diViews'] . '"'; $info['classLastAction'] = 'class="' . $info['classLastAction'] . '" id="' . $info['idLastAction'] . '"'; } elseif (!$info['id']) { $info['classThreadtitle'] = 'class="' . $info['classThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['classReplies'] . '"'; $info['classViews'] = 'class="' . $info['classViews'] . '"'; $info['classLastAction'] = 'class="' . $info['classLastAction'] . '"'; } else { $info['classThreadtitle'] = 'id="' . $info['idThreadtitle'] . '"'; $info['classReplies'] = 'id="' . $info['idReplies'] . '"'; $info['classViews'] = 'id="' . $info['idViews'] . '"'; $info['classLastAction'] = 'id="' . $info['idLastAction'] . '"'; } # die(">". $UserPerm); $dbr = wfGetDB(DB_SLAVE); $permsql = substr($perm_sql, 0, -4); // if(strlen($info['forum']) > 0) $permsql = substr($permsql, 0, -4); $info['forum'] = substr($info['forum'], 4, strlen($info['forum'])); if (strlen($info['forum']) > 0 and strlen($permsql) > 0) { $permsql .= ' AND '; } $awc_f_threads = $dbr->tableName('awc_f_threads'); $awc_f_forums = $dbr->tableName('awc_f_forums'); $awc_f_cats = $dbr->tableName('awc_f_cats'); $awc_f_posts = $dbr->tableName('awc_f_posts'); $sql = "SELECT {$awc_f_threads}.*, {$awc_f_forums}.f_name, {$awc_f_forums}.f_desc, {$awc_f_forums}.f_id, {$awc_f_forums}.f_parentid, {$awc_f_cats}.cat_name, {$awc_f_cats}.cat_id, {$awc_f_cats}.c_wiki_perm\n FROM {$awc_f_threads}\n INNER JOIN {$awc_f_forums}\n ON {$awc_f_threads}.t_forumid={$awc_f_forums}.f_id\n INNER JOIN {$awc_f_cats}\n ON {$awc_f_cats}.cat_id={$awc_f_forums}.f_parentid\n WHERE {$permsql} \n " . $info['forum'] . " AND {$awc_f_forums}.f_passworded = 0\n ORDER BY {$awc_f_threads}.t_lastdate DESC\n LIMIT " . $info['howmanythreads']; # die(">".$permsql); /* * GROUP BY $awc_f_threads.t_id * $sql = "SELECT $awc_f_threads.*, $awc_f_forums.f_name, $awc_f_forums.f_desc, $awc_f_forums.f_id, $awc_f_forums.parent_id, $awc_f_cats.cat_name, $awc_f_cats.cat_id, $awc_f_cats.c_wiki_perm FROM $awc_f_threads INNER JOIN $awc_f_forums ON $awc_f_threads.t_forumid=$awc_f_forums.f_id INNER JOIN $awc_f_cats ON $awc_f_cats.cat_id=$awc_f_forums.parent_id WHERE $permsql ".$info['forum']." AND $awc_f_forums.f_passworded = 0 GROUP BY $awc_f_threads.t_id ORDER BY $awc_f_threads.t_lastdate DESC LIMIT " . $info['howmanythreads']; $sql = $dbr->selectSQLText( array( 'awc_f_threads', 'awc_f_posts', 'awc_f_forums', 'awc_f_cats' ), array( "$awc_f_posts.*, $awc_f_threads.*, f_name, f_desc, f_id, parent_id, cat_name, cat_id" ), "$permsql ".$info['forum']." AND f_passworded = 0", __METHOD__, array('OFFSET' => 0, 'LIMIT' => $info['howmanythreads'], 'GROUP BY' => 't_id', 'ORDER BY' => 't_lastdate DESC, p_id DESC',), array( 'awc_f_posts' => array('JOIN','t_id=thread_id'), 'awc_f_forums' => array('JOIN','t_forumid=f_id'), 'awc_f_cats' => array('JOIN','parent_id=cat_id')) ); */ if (strlen($info['forum']) == 0 and strlen($permsql) == 0) { $sql = str_replace('WHERE', '', $sql); } // awc_pdie($sql); $html = null; $singleline = null; if ($res = $dbr->query($sql)) { while ($r = $dbr->fetchObject($res)) { $f_name = $r->f_name; $f_id = $r->f_id; $tTitle = awcsforum_funcs::awc_html_entity_decode($r->t_name); $str_len($tTitle) > $awcs_forum_config->cf_forumTag_titlecutoff ? $t_name = awcsforum_funcs::awc_shorten($tTitle, $awcs_forum_config->cf_forumTag_titlecutoff) . "..." : ($t_name = $tTitle); $tmp = $info['imgBeforeThreadTitle'] . ' ' . $info['txtBeforeThreadTitle'] . ' <a href="' . $awc['link'] . 'st/id' . $r->t_id . '">' . $t_name . '</a>'; $limit = null; #$total['TotalPosts'] = null; $send['t_topics'] = $r->t_topics; $send['t_id'] = $r->t_id; $send['t_name'] = $r->t_name; $send['link'] = $this->awc_url; $t = null; if ($r->t_ann == "1") { $t = get_awcsforum_word('thread_makeAnnouncement') . " "; } if ($r->t_status == "1") { $t = get_awcsforum_word('1indicator_locked') . " "; } if ($r->t_pin == "1") { $t = get_awcsforum_word('1indicator_sticky') . " "; } if ($r->t_pin == "1" and $r->t_status == "1") { $t = get_awcsforum_word('1indicator_lockSticky') . " "; } if ($r->t_poll == "1") { $t = get_awcsforum_word('1indicator_poll') . " "; } # $TotalPosts = $tmp['TotalPosts']; # $limit = GetLimit($TotalPosts); $thread_tools->link = $this->awc_url; $thread_tools->tID = $r->t_id; $thread_tools->total_posts = $r->t_topics; $limit = $thread_tools->GetThreadPostLimit(); //$limit = GetThreadPostLimit($send); $tmp = $t . $tmp . ' ' . $limit; # die($awc['link']); $html .= '<tr>'; $html .= '<td width="100%" ' . $info['classThreadtitle'] . ' style="' . $info['styleThreadtitle'] . '" nowrap>' . $tmp . '</td>'; $singleline .= '<tr><td width="100%" ' . $info['classThreadtitle'] . ' style="' . $info['styleThreadtitle'] . '" >'; $singleline .= $tmp; # $singleline .= ; if ($info['replies'] == "yes") { $html .= '<td ' . $info['classReplies'] . ' style="' . $info['styleReplies'] . '" nowrap>' . $r->t_topics . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleReplies'] . '"> (' . $r->t_topics . ' ' . $info['wReplies'] . ') </SPAN>'; } if ($info['postcount'] == "yes") { $html .= '<td ' . $info['classViews'] . ' style="' . $info['styleViews'] . '" nowrap>' . $r->t_hits . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleViews'] . '"> (' . $r->t_hits . ' ' . $info['wViews'] . ') </SPAN> '; } if ($info['date'] == "yes" || $info['users'] == "yes") { $u = $r->t_lastuser == '' ? $r->p_user : $r->t_lastuser; $uID = $r->t_lastuser == '' ? $r->p_userid : $r->t_lastuserid; #$u = $wgOut->parse("[[User:$u|$u]]"); $u = "<a href='" . $awc['link'] . "mem_profile/{$u}/{$uID}'>{$u}</a>"; $rplac = array('<p>', '</p>', chr(10)); $u = str_replace($rplac, '', $u); $u = $info['users'] == "yes" ? ' - ' . $u : null; $d = $info['date'] == "yes" ? '<a href="' . $awc['link'] . 'last_post/id' . $r->t_id . '"> ' . awcsforum_funcs::convert_date($r->t_lastdate, "s") . ' </a>' . ' ' : null; $html .= '<td ' . $info['classLastAction'] . ' style="' . $info['styleLastAction'] . '" nowrap>' . $d . $u . '</td>'; $singleline .= ' <SPAN STYLE="' . $info['styleLastAction'] . '"> (' . $d . $u . ') </SPAN><td></tr>'; } $html .= '</tr>'; } $dbr->freeResult($res); } if ($f_name == '') { return; } if ($info['header_both']) { $info['classThreadtitle'] = 'class="' . $info['header_classThreadtitle'] . '" id="' . $info['header_idThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['header_classReplies'] . '" id="' . $info['header_idReplies'] . '"'; $info['classViews'] = 'class="' . $info['header_classViews'] . '" id="' . $info['header_diViews'] . '"'; $info['classLastAction'] = 'class="' . $info['header_classLastAction'] . '" id="' . $info['header_idLastAction'] . '"'; } elseif (!$info['header_id']) { $info['classThreadtitle'] = 'class="' . $info['header_classThreadtitle'] . '"'; $info['classReplies'] = 'class="' . $info['header_classReplies'] . '"'; $info['classViews'] = 'class="' . $info['header_classViews'] . '"'; $info['classLastAction'] = 'class="' . $info['header_classLastAction'] . '"'; } else { $info['classThreadtitle'] = 'id="' . $info['header_idThreadtitle'] . '"'; $info['classReplies'] = 'id="' . $info['header_idReplies'] . '"'; $info['classViews'] = 'id="' . $info['header_idViews'] . '"'; $info['classLastAction'] = 'id="' . $info['header_idLastAction'] . '"'; } $out = null; if ($info['showall'] == false) { $out = '<table width="' . $info['width'] . '" cellpadding="0" cellspacing="0"><tr><td nowrap><a href="' . $awc['link'] . 'sf/id' . $f_id . '">' . $f_name . '</a><hr></td></tr></table>'; } $out .= '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0">'; $out .= '<tr>'; $singleline_out = '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0"><tr>'; $out .= '<td width="75%" align="left" class="' . $info['header_classThreadtitle'] . '" style="' . $info['header_styleThreadtitle'] . '" nowrap>' . $info['wThreadtitle'] . '</td>'; if ($info['replies'] == "yes") { $out .= '<td width="1%" align="left" class="' . $info['header_classReplies'] . '" style="' . $info['header_styleReplies'] . '" nowrap>' . $info['wReplies'] . '</td>'; } if ($info['postcount'] == "yes") { $out .= '<td width="1%" align="left" class="' . $info['header_classViews'] . '" style="' . $info['header_styleViews'] . '" nowrap>' . $info['wViews'] . '</td>'; } #if($info['users'] == true) $out .= '<td width="1%" align="left" nowrap>'.get_awcsforum_word('forum_started_by').'</td>'; if ($info['date'] == "yes" || $info['users'] == "yes") { $out .= '<td width="20%" align="left" class="' . $info['header_classLastAction'] . '" style="' . $info['header_styleLastAction'] . '" nowrap>' . $info['wLastAction'] . '</td>'; } $out .= '</tr>'; $out .= $html; $out .= '</table><br />'; $singleline_out = '<table width="' . $info['width'] . '" cellpadding="2" cellspacing="0">'; $singleline_out .= $singleline; $singleline_out .= '</table><br />'; $out = str_replace(chr(10), '', $out); $singleline_out = str_replace(chr(10), '', $singleline_out); if ($info['inline']) { return $singleline_out; } return $out; }