while ($rssfeeds = $data->fetch_array($rsssql)) { $itemid = $rssfeeds['itemid']; $userid = $rssfeeds['userid']; if ($rssfeeds['type'] == 1) { $forums[] = $itemid; } elseif ($rssfeeds['type'] == 2) { $blog[] = $itemid; } elseif ($rssfeeds['type'] == 3) { $calendar = true; } elseif ($rssfeeds['type'] == 4 || $rssfeeds['type'] == 5) { $articles[] = $itemid; } elseif ($rssfeeds['type'] == 6) { $news = true; } } $usergroups = user_groups_id_array($userid); $forumlist = sql_list($forums, "forum", "OR"); $bloglist = sql_list($blog, "`group`", "OR"); $articlelist = sql_list($articles, "patrol", "OR"); if ($forumlist != "") { $sql = $data->select_query("forumtopics", "WHERE {$forumlist} ORDER BY lastdate DESC LIMIT {$config['numsidebox']}"); if ($data->num_rows($sql)) { while ($temp = $data->fetch_array($sql)) { $temp2 = $data->select_fetch_one_row("forumauths", "WHERE forum_id={$temp['forum']}"); $view_forum = unserialize($temp2['view_forum']); $read_topics = unserialize($temp2['read_topics']); $viewauth = 0; $readauth = 0; for ($i = 0; $i < count($usergroups); $i++) { $viewauth = $viewauth || $view_forum[$usergroups[$i]]; $readauth = $readauth || $read_topics[$usergroups[$i]];
} else { $time = "0"; } $sql = $data->insert_query("owners", "'', {$safe_id}, {$cattype}, {$owner}, {$owner_type}, {$type_owner}, {$time}"); if ($sql) { show_message("Owner added", "index.php?page=mythings&cat={$cat}&action=owner&id={$id}&menuid={$menuid}"); } } } elseif ($action == "adddown") { $pagenum = 8; $sql = $data->select_query("download_cats"); $cats = array(); $numcats = 0; while ($row = $data->fetch_array($sql)) { $temp = unserialize($row['upauth']); $usergroups = user_groups_id_array($check['id']); $allowed = 0; for ($i = 0; $i < count($usergroups); $i++) { if ($temp[$usergroups[$i]] == 1) { $allowed = 1; } } if ($allowed == 1) { $cats[] = $row; $numcats++; } } $quer = $data->select_query("album_track", "WHERE allowed=1 AND trash=0 ORDER BY album_name ASC"); $numalbum = $data->num_rows($quer); $albums = array(); while ($temp = $data->fetch_array($quer)) {
function forumEmail($type, $post, $fid, $topic_id = false) { global $data, $check, $config; $user_id = safesql($check['id'], "int"); $postuname = $check['uname']; $website = $config['troopname']; $link = get_path("index.php?page=forums&action=topic&t={$topic_id}&late=1"); $extract = strip_tags($post['posttext']); $id = $post['id']; if ($type == "reply") { $sqls = $data->select_query("forumstopicwatch", "WHERE topic_id={$topic_id} AND uid != {$user_id} AND (notify=1 OR notify=2)"); $email = $data->select_fetch_one_row("emails", "WHERE type='reply'"); $topic = $data->select_fetch_one_row("forumtopics", "WHERE id={$topic_id}"); $title = $topic['subject']; while ($topicwatch = $data->fetch_array($sqls)) { $tempsql = $data->select_query("users", "WHERE id='{$topicwatch['uid']}'"); $temp = $data->fetch_array($tempsql); if ($check['id'] != "-1") { $usergroups = user_groups_id_array($check['id']); } else { $usergroups = array(0 => "-1"); } $sql2 = $data->select_query("forumauths", "WHERE forum_id={$fid}"); $auth = $data->fetch_array($sql2); $view_forum = unserialize($auth['view_forum']); $read_topics = unserialize($auth['read_topics']); $viewauth = 0; $readauth = 0; for ($i = 0; $i < count($usergroups); $i++) { $viewauth = $viewauth || $view_forum[$usergroups[$i]]; $readauth = $readauth || $read_topics[$usergroups[$i]]; } if ($topicwatch['notify'] == "1") { $data->update_query("forumstopicwatch", "notify=0", "topic_id={$topic_id} AND uid='{$topicwatch['uid']}'"); } if ($viewauth == 1 && $readauth == 1 && $temp['allowemail'] == 1 && $temp['replytopic'] == 1) { $type = "forum reply"; $cmscoutTags = array("!#uname#!", "!#postuname#!", "!#title#!", "!#type#!", "!#link#!", "!#extract#!", "!#website#!"); $replacements = array($temp['uname'], $postuname, $title, $type, $link, $extract, $website); $emailContent = str_replace($cmscoutTags, $replacements, $email['email']); sendMail($temp['email'], $temp['uname'], $config['emailPrefix'] . $email['subject'], $emailContent); } } } elseif ($type == "newtopic") { $email = $data->select_fetch_one_row("emails", "WHERE type='newtopic'"); $topic = $data->select_fetch_one_row("forumtopics", "WHERE id={$topic_id}"); $title = $topic['subject']; $sqls = $data->select_query("users", "WHERE newtopic=1 AND allowemail=1 AND id != {$check['id']}", "id, uname, email"); $topicpath = get_path("index.php?page=forums&action=topic&t={$topic['id']}"); while ($topicwatch = $data->fetch_array($sqls)) { $tempstuff = $data->fetch_array($sql2); $usergroups = user_groups_id_array($topicwatch['id']); $sql = $data->select_query("forumauths", "WHERE forum_id={$fid}"); $auth = $data->fetch_array($sql); $view_forum = unserialize($auth['view_forum']); $read_topics = unserialize($auth['read_topics']); $viewauth = 0; $readauth = 0; for ($i = 0; $i < count($usergroups); $i++) { $viewauth = $viewauth || $view_forum[$usergroups[$i]]; $readauth = $readauth || $read_topics[$usergroups[$i]]; } if ($readauth == 1 && $viewauth == 1) { $type = "new topic"; $cmscoutTags = array("!#uname#!", "!#postuname#!", "!#title#!", "!#type#!", "!#link#!", "!#extract#!", "!#website#!"); $replacements = array($topicwatch['uname'], $postuname, $title, $type, $link, $extract, $website); $emailContent = str_replace($cmscoutTags, $replacements, $email['email']); sendMail($topicwatch['email'], $topicwatch['uname'], $config['emailPrefix'] . $email['subject'], $emailContent); } } } }