Beispiel #1
0
function search_spammers($keywords)
{
    global $CFG, $USER, $DB, $OUTPUT;
    if (!is_array($keywords)) {
        $keywords = array($keywords);
        // Make it into an array
    }
    $like = $DB->sql_ilike();
    $keywordfull = array();
    foreach ($keywords as $keyword) {
        $keyword = addslashes($keyword);
        // Just to be safe
        $keywordfull[] = " description {$like} '%{$keyword}%' ";
        $keywordfull2[] = " p.summary {$like} '%{$keyword}%' ";
    }
    $conditions = '( ' . implode(' OR ', $keywordfull) . ' )';
    $conditions2 = '( ' . implode(' OR ', $keywordfull2) . ' )';
    $sql = "SELECT * FROM {user} WHERE deleted = 0 AND id <> {$USER->id} AND {$conditions}";
    // Exclude oneself
    $sql2 = "SELECT u.*, p.summary FROM {user} AS u, {post} AS p WHERE {$conditions2} AND u.deleted = 0 AND u.id=p.userid AND u.id <> {$USER->id}";
    $spamusers_desc = $DB->get_recordset_sql($sql);
    $spamusers_blog = $DB->get_recordset_sql($sql2);
    $keywordlist = implode(', ', $keywords);
    echo $OUTPUT->box(get_string('spamresult', 'report_spamcleaner') . s($keywordlist)) . ' ...';
    print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
}
Beispiel #2
0
function search_spammers($keywords)
{
    global $CFG, $USER, $DB, $OUTPUT;
    if (!is_array($keywords)) {
        $keywords = array($keywords);
        // Make it into an array
    }
    $params = array('userid' => $USER->id);
    $keywordfull = array();
    $i = 0;
    foreach ($keywords as $keyword) {
        $keywordfull[] = $DB->sql_like('description', ':descpat' . $i, false);
        $params['descpat' . $i] = "%{$keyword}%";
        $keywordfull2[] = $DB->sql_like('p.summary', ':sumpat' . $i, false);
        $params['sumpat' . $i] = "%{$keyword}%";
        $keywordfull3[] = $DB->sql_like('p.subject', ':subpat' . $i, false);
        $params['subpat' . $i] = "%{$keyword}%";
        $keywordfull4[] = $DB->sql_like('c.content', ':contpat' . $i, false);
        $params['contpat' . $i] = "%{$keyword}%";
        $keywordfull5[] = $DB->sql_like('m.fullmessage', ':msgpat' . $i, false);
        $params['msgpat' . $i] = "%{$keyword}%";
        $keywordfull6[] = $DB->sql_like('fp.message', ':forumpostpat' . $i, false);
        $params['forumpostpat' . $i] = "%{$keyword}%";
        $keywordfull7[] = $DB->sql_like('fp.subject', ':forumpostsubpat' . $i, false);
        $params['forumpostsubpat' . $i] = "%{$keyword}%";
        $i++;
    }
    $conditions = '( ' . implode(' OR ', $keywordfull) . ' )';
    $conditions2 = '( ' . implode(' OR ', $keywordfull2) . ' )';
    $conditions3 = '( ' . implode(' OR ', $keywordfull3) . ' )';
    $conditions4 = '( ' . implode(' OR ', $keywordfull4) . ' )';
    $conditions5 = '( ' . implode(' OR ', $keywordfull5) . ' )';
    $conditions6 = '( ' . implode(' OR ', $keywordfull6) . ' )';
    $conditions7 = '( ' . implode(' OR ', $keywordfull7) . ' )';
    $sql = "SELECT * FROM {user} WHERE deleted = 0 AND id <> :userid AND {$conditions}";
    // Exclude oneself
    $sql2 = "SELECT u.*, p.summary FROM {user} AS u, {post} AS p WHERE {$conditions2} AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
    $sql3 = "SELECT u.*, p.subject as postsubject FROM {user} AS u, {post} AS p WHERE {$conditions3} AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
    $sql4 = "SELECT u.*, c.content FROM {user} AS u, {comments} AS c WHERE {$conditions4} AND u.deleted = 0 AND u.id=c.userid AND u.id <> :userid";
    $sql5 = "SELECT u.*, m.fullmessage FROM {user} AS u, {message} AS m WHERE {$conditions5} AND u.deleted = 0 AND u.id=m.useridfrom AND u.id <> :userid";
    $sql6 = "SELECT u.*, fp.message FROM {user} AS u, {forum_posts} AS fp WHERE {$conditions6} AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
    $sql7 = "SELECT u.*, fp.subject FROM {user} AS u, {forum_posts} AS fp WHERE {$conditions7} AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
    $spamusers_desc = $DB->get_recordset_sql($sql, $params);
    $spamusers_blog = $DB->get_recordset_sql($sql2, $params);
    $spamusers_blogsub = $DB->get_recordset_sql($sql3, $params);
    $spamusers_comment = $DB->get_recordset_sql($sql4, $params);
    $spamusers_message = $DB->get_recordset_sql($sql5, $params);
    $spamusers_forumpost = $DB->get_recordset_sql($sql6, $params);
    $spamusers_forumpostsub = $DB->get_recordset_sql($sql7, $params);
    $keywordlist = implode(', ', $keywords);
    echo $OUTPUT->box(get_string('spamresult', 'tool_spamcleaner') . s($keywordlist)) . ' ...';
    print_user_list(array($spamusers_desc, $spamusers_blog, $spamusers_blogsub, $spamusers_comment, $spamusers_message, $spamusers_forumpost, $spamusers_forumpostsub), $keywords);
}
Beispiel #3
0
 function printUserTable()
 {
     print_user_list($this->pager, $this->users, $this->db->get_err(), $this->javascript);
     $this->pager->text_style = 'font-size:11px;';
     $this->pager->printPages();
 }
Beispiel #4
0
    ?>
</label> 
	<label><input type="radio" name="overwrite" value="N" />&nbsp;<?php 
    etranslate("No");
    ?>
</label>
</td></tr>
<!-- /IVCAL -->

<tr class="browse"><td>
	<label for="fileupload">Upload file:</label></td><td>
	<input type="file" name="FileName" id="fileupload" size="45" maxlength="50" />
</td></tr>

<?php 
    print_user_list();
    ?>
</table>
<br /><input type="submit" value="<?php 
    etranslate("Import");
    ?>
" />
</form>
</div> <!-- /IMPORT -->
<?php 
}
// end if $file_upload_enabled
?>

<?php 
include_once 'export.php';
Beispiel #5
0
function search_spammers($keywords)
{
    global $CFG, $USER, $DB, $OUTPUT;
    if (!is_array($keywords)) {
        $keywords = array($keywords);
        // Make it into an array
    }
    $params = array('userid' => $USER->id);
    $keywordfull = array();
    $i = 0;
    foreach ($keywords as $keyword) {
        $keywordfull[] = $DB->sql_like('description', ':descpat' . $i, false);
        $params['descpat' . $i] = "%{$keyword}%";
        $keywordfull2[] = $DB->sql_like('p.summary', ':sumpat' . $i, false);
        $params['sumpat' . $i] = "%{$keyword}%";
        $i++;
    }
    $conditions = '( ' . implode(' OR ', $keywordfull) . ' )';
    $conditions2 = '( ' . implode(' OR ', $keywordfull2) . ' )';
    $sql = "SELECT * FROM {user} WHERE deleted = 0 AND id <> :userid AND {$conditions}";
    // Exclude oneself
    $sql2 = "SELECT u.*, p.summary FROM {user} AS u, {post} AS p WHERE {$conditions2} AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
    $spamusers_desc = $DB->get_recordset_sql($sql, $params);
    $spamusers_blog = $DB->get_recordset_sql($sql2, $params);
    $keywordlist = implode(', ', $keywords);
    echo $OUTPUT->box(get_string('spamresult', 'tool_spamcleaner') . s($keywordlist)) . ' ...';
    print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
}
Beispiel #6
0
<body>
<?php 
//if session exists, do chat
try {
    $checkOnline = $dbh->prepare('SELECT * FROM sessions WHERE session_id = :sid');
    $checkOnline->execute(array(':sid' => session_id()));
    $rows = $checkOnline->fetchAll();
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die;
}
if (count($rows) > 0) {
    ?>
<strong>Online now:</strong><ul class="chatusers">
<?php 
    print_user_list($dbh);
    ?>
</ul>
<div class="chatwindow">
<ul class="chatlog">
<?php 
    print_chat_log($dbh);
    ?>
</ul>
</div>
<form id="chat" class="chatform" method="post" action="add-chat.php">
    <label for="message">Share your thoughts:</label>
    <input name="message" id="message" maxlength="512" autofocus>
    <input type="submit" value="Chat">
</form>
<?php 
Beispiel #7
0
/**
 * Prints a table of the users tagged with the tag passed as argument
 *
 * @param $tag_object
 * @param int $users_per_row number of users per row to display
 * @param int $limitfrom prints users starting at this point (optional, required if $limitnum is set).
 * @param int $limitnum prints this many users (optional, required if $limitfrom is set).
 * @param $return if true return html string
 */
function print_tagged_users_table($tag_object, $limitfrom = '', $limitnum = '', $return = false)
{
    //List of users with this tag
    $userlist = array_values(get_items_tagged_with('user', $tag_object->id, 'lastaccess DESC', 'id, firstname, lastname, picture', $limitfrom, $limitnum));
    $output = print_user_list($userlist, true);
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}