Esempio n. 1
0
 public function __construct($data, $cron = false)
 {
     parent::__construct($data, $cron);
     $post = get_record_sql('
         SELECT
             p.subject, p.body, p.poster, p.parent, ' . db_format_tsfield('p.ctime', 'ctime') . ',
             t.id AS topicid, fp.subject AS topicsubject, f.title AS forumtitle, g.id AS groupid, g.name AS groupname, f.id AS forumid
         FROM {interaction_forum_post} p
         INNER JOIN {interaction_forum_topic} t ON (t.id = p.topic AND t.deleted = 0)
         INNER JOIN {interaction_forum_post} fp ON (fp.parent IS NULL AND fp.topic = t.id)
         INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted = 0)
         INNER JOIN {group} g ON (f.group = g.id AND g.deleted = 0)
         WHERE p.id = ? AND p.deleted = 0', array($this->postid));
     // The post may have been deleted during the activity delay
     if (!$post) {
         $this->users = array();
         return;
     }
     // Set notification to site admins.
     $siteadmins = activity_get_users($this->get_id(), null, null, true);
     // Get forum moderators and admins.
     $forumadminsandmoderators = activity_get_users($this->get_id(), array_merge(get_forum_moderators($post->forumid), group_get_admin_ids($post->groupid)));
     // Populate users to notify list and get rid of duplicates.
     foreach (array_merge($siteadmins, $forumadminsandmoderators) as $user) {
         if (!isset($this->users[$user->id])) {
             $this->users[$user->id] = $user;
         }
     }
     // Record who reported it.
     $this->fromuser = $this->reporter;
     $post->posttime = strftime(get_string('strftimedaydatetime'), $post->ctime);
     $post->textbody = trim(html2text($post->body));
     $post->htmlbody = clean_html($post->body);
     $this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid . '&objection=1';
     $this->add_urltext(array('key' => 'Topic', 'section' => 'interaction.forum'));
     if ($this->event === REPORT_OBJECTIONABLE) {
         $this->overridemessagecontents = true;
         $this->strings->subject = (object) array('key' => 'objectionablecontentpost', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter)));
     } else {
         if ($this->event === MAKE_NOT_OBJECTIONABLE) {
             $this->strings = (object) array('subject' => (object) array('key' => 'postnotobjectionablesubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'postnotobjectionablebody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster))));
         } else {
             if ($this->event === DELETE_OBJECTIONABLE_POST) {
                 $this->url = '';
                 $this->strings = (object) array('subject' => (object) array('key' => 'objectionablepostdeletedsubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'objectionablepostdeletedbody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster), $post->textbody)));
             } else {
                 if ($this->event === DELETE_OBJECTIONABLE_TOPIC) {
                     $this->url = '';
                     $this->strings = (object) array('subject' => (object) array('key' => 'objectionabletopicdeletedsubject', 'section' => 'interaction.forum', 'args' => array($post->topicsubject, display_default_name($this->reporter))), 'message' => (object) array('key' => 'objectionabletopicdeletedbody', 'section' => 'interaction.forum', 'args' => array(display_default_name($this->reporter), display_default_name($post->poster), $post->textbody)));
                 } else {
                     throw new SystemException();
                 }
             }
         }
     }
     $this->temp = (object) array('post' => $post);
 }
Esempio n. 2
0
 }
 $forid = $a["id"];
 $overforumname = $a["name"];
 print "<tr><td align=\"left\" class=\"colhead\" width=\"99%\">" . htmlspecialchars($overforumname) . "</td><td align=\"center\" class=\"colhead\">" . $lang_forums['col_topics'] . "</td>" . "<td align=\"center\" class=\"colhead\">" . $lang_forums['col_posts'] . "</td>" . "<td align=\"left\" class=\"colhead\">" . $lang_forums['col_last_post'] . "</td><td class=\"colhead\" align=\"left\">" . $lang_forums['col_moderator'] . "</td></tr>\n";
 $forums = get_forum_row();
 foreach ($forums as $forums_arr) {
     if ($forums_arr['forid'] != $forid) {
         continue;
     }
     if (get_user_class() < $forums_arr["minclassread"]) {
         continue;
     }
     $forumid = $forums_arr["id"];
     $forumname = htmlspecialchars($forums_arr["name"]);
     $forumdescription = htmlspecialchars($forums_arr["description"]);
     $forummoderators = get_forum_moderators($forums_arr['id'], false);
     if (!$forummoderators) {
         $forummoderators = "<a href=\"contactstaff.php\"><i>" . $lang_forums['text_apply_now'] . "</i></a>";
     }
     $topiccount = number_format($forums_arr["topiccount"]);
     $postcount = number_format($forums_arr["postcount"]);
     // Find last post ID
     //Returns the ID of the last post of a forum
     if (!($arr = $Cache->get_value('forum_' . $forumid . '_last_replied_topic_content'))) {
         $res = sql_query("SELECT * FROM topics WHERE forumid=" . sqlesc($forumid) . " ORDER BY lastpost DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
         $arr = mysql_fetch_array($res);
         $Cache->cache_value('forum_' . $forumid . '_last_replied_topic_content', $arr, 900);
     }
     if ($arr) {
         $lastpostid = $arr['lastpost'];
         // Get last post info
Esempio n. 3
0
</h2>
<table border=0 class=main cellspacing=0 cellpadding=5 width=1%><tr>
<td class=embedded align=left><form method="get" action="moforums.php"><input type="submit" value="<?php 
    echo $lang_forummanage['submit_overforum_management'];
    ?>
" class="btn"></form></td><td class=embedded align=left><form method="get" action="forummanage.php"><input type=hidden name="action" value="newforum"><input type="submit" value="<?php 
    echo $lang_forummanage['submit_add_forum'];
    ?>
" class="btn"></form></td>
</tr></table>
<?php 
    echo '<table width="100%"  border="0" align="center" cellpadding="2" cellspacing="0">';
    echo "<tr><td class=colhead align=left>" . $lang_forummanage['col_name'] . "</td><td class=colhead>" . $lang_forummanage['col_overforum'] . "</td><td class=colhead>" . $lang_forummanage['col_read'] . "</td><td class=colhead>" . $lang_forummanage['col_write'] . "</td><td class=colhead>" . $lang_forummanage['col_create_topic'] . "</td><td class=colhead>" . $lang_forummanage['col_moderator'] . "</td><td class=colhead>" . $lang_forummanage['col_modify'] . "</td></tr>";
    $result = sql_query("SELECT forums.*, overforums.name AS of_name FROM forums LEFT JOIN overforums ON forums.forid=overforums.id ORDER BY forums.sort ASC");
    if ($row = mysql_fetch_array($result)) {
        do {
            $name = $row['of_name'];
            $moderators = get_forum_moderators($row['id'], false);
            if (!$moderators) {
                $moderators = $lang_forummanage['text_not_available'];
            }
            echo "<tr><td><a href=forums.php?action=viewforum&forumid=" . $row["id"] . "><b>" . htmlspecialchars($row["name"]) . "</b></a><br />" . htmlspecialchars($row["description"]) . "</td>";
            echo "<td>" . htmlspecialchars($name) . "</td><td>" . get_user_class_name($row["minclassread"], false, true, true) . "</td><td>" . get_user_class_name($row["minclasswrite"], false, true, true) . "</td><td>" . get_user_class_name($row["minclasscreate"], false, true, true) . "</td><td>" . $moderators . "</td><td><b><a href=\"" . $PHP_SELF . "?action=editforum&id=" . $row["id"] . "\">" . $lang_forummanage['text_edit'] . "</a>&nbsp;|&nbsp;<a href=\"javascript:confirm_delete('" . $row["id"] . "', '" . $lang_forummanage['js_sure_to_delete_forum'] . "', '');\"><font color=red>" . $lang_forummanage['text_delete'] . "</font></a></b></td></tr>";
        } while ($row = mysql_fetch_array($result));
    } else {
        print "<tr><td colspan=6>" . $lang_forummanage['text_no_records_found'] . "</td></tr>";
    }
    echo "</table>";
}
end_main_frame();
stdfoot();