예제 #1
0
파일: install.php 프로젝트: Krytic/MyBBWiki
 private function handleMyAlerts()
 {
     global $db, $cache;
     if (class_exists('MybbStuff_MyAlerts_AlertTypeManager')) {
         $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
         if (!$alertTypeManager) {
             $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
         }
         $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
         $alertType->setCode('mybb_wiki_alert_code');
         // The codename for your alert type. Can be any unique string.
         $alertType->setEnabled(true);
         $alertType->setCanBeUserDisabled(true);
         $alertTypeManager->add($alertType);
     }
 }
예제 #2
0
function myalerts_acp_manage_alert_types()
{
    global $mybb, $lang, $page, $db, $cache;
    $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
    $alertTypes = $alertTypeManager->getAlertTypes();
    if (strtolower($mybb->request_method) == 'post') {
        if (!verify_post_check($mybb->get_input('my_post_key'))) {
            flash_message($lang->invalid_post_verify_key2, 'error');
            admin_redirect("index.php?module=config-myalerts_alert_types");
        }
        $enabledAlertTypes = $mybb->get_input('alert_types_enabled', MyBB::INPUT_ARRAY);
        $canBeUserDisabled = $mybb->get_input('alert_types_can_be_user_disabled', MyBB::INPUT_ARRAY);
        $enabledAlertTypes = array_map('intval', array_keys($enabledAlertTypes));
        $canBeUserDisabled = array_map('intval', array_keys($canBeUserDisabled));
        $updateArray = array();
        foreach ($alertTypes as $alertType) {
            $type = MybbStuff_MyAlerts_Entity_AlertType::unserialize($alertType);
            $type->setEnabled(in_array($type->getId(), $enabledAlertTypes));
            $type->setCanBeUserDisabled(in_array($type->getId(), $canBeUserDisabled));
            $updateArray[] = $type;
        }
        $alertTypeManager->updateAlertTypes($updateArray);
        flash_message($lang->myalerts_alert_types_updated, 'success');
        admin_redirect("index.php?module=config-myalerts_alert_types");
    } else {
        $page->output_header($lang->myalerts_alert_types);
        $form = new Form('index.php?module=config-myalerts_alert_types', 'post');
        $table = new Table();
        $table->construct_header($lang->myalerts_alert_type_code);
        $table->construct_header($lang->myalerts_alert_type_enabled, array('width' => '5%', 'class' => 'align_center'));
        $table->construct_header($lang->myalerts_alert_type_can_be_user_disabled, array('width' => '10%', 'class' => 'align_center'));
        $noResults = false;
        if (!empty($alertTypes)) {
            foreach ($alertTypes as $type) {
                $alertCode = htmlspecialchars_uni($type['code']);
                $table->construct_cell($alertCode);
                $table->construct_cell($form->generate_check_box('alert_types_enabled[' . $type['id'] . ']', '', '', array('checked' => $type['enabled'])));
                $table->construct_cell($form->generate_check_box('alert_types_can_be_user_disabled[' . $type['id'] . ']', '', '', array('checked' => $type['can_be_user_disabled'])));
                $table->construct_row();
            }
        } else {
            $table->construct_cell($lang->myalerts_no_alert_types, array('colspan' => 2));
            $table->construct_row();
            $noResults = true;
        }
        $table->output($lang->myalerts_alert_types);
        if (!$noResults) {
            $buttons[] = $form->generate_submit_button($lang->myalerts_update_alert_types);
            $form->output_submit_wrapper($buttons);
        }
        $form->end();
        $page->output_footer();
    }
}
예제 #3
0
function trader_install()
{
    global $db, $cache;
    $db->write_query("CREATE TABLE IF NOT EXISTS " . TABLE_PREFIX . "trade_feedback (\n        `fid` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n        `giver` INT UNSIGNED DEFAULT 1,\n        `receiver` INT UNSIGNED NOT NULL DEFAULT 1,\n        `dateline` BIGINT NOT NULL,\n        `approved` TINYINT(1),\n        `comments` TEXT,\n        `type` VARCHAR(15) DEFAULT 'receiver',\n        `value` TINYINT(1) DEFAULT 0,\n        `reported` TINYINT(1) DEFAULT 0,\n        `threadlink` TEXT,\n        `tid` INT NOT NULL DEFAULT 0,\n        `forum_id` INT NOT NULL DEFAULT 0,\n        KEY giver(giver),\n        KEY receiver(receiver)\n        ) ENGINE=Innodb " . $db->build_create_table_collation());
    // Now alter the users table
    if (!$db->field_exists("posreps", "users")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "users \n            ADD posreps INT UNSIGNED DEFAULT 0,\n            ADD neutreps INT UNSIGNED DEFAULT 0,\n            ADD negreps INT UNSIGNED DEFAULT 0");
    }
    // Usergroup Permissions
    if (!$db->field_exists("cantradefeedback", "usergroups")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "usergroups\n            ADD cantradefeedback INT UNSIGNED DEFAULT 1");
    }
    // Banned usergroups can't leave feedback
    $db->write_query("UPDATE " . TABLE_PREFIX . "usergroups SET cantradefeedback=0 WHERE isbannedgroup=1");
    $cache->update_usergroups();
    // MyAlerts Integration
    // Check if MyAlerts exists and is compatible
    if (function_exists("myalerts_info")) {
        // Load myalerts info into an array
        $my_alerts_info = myalerts_info();
        // Set version info to a new var
        $verify = $my_alerts_info['version'];
        // If MyAlerts 2.0 or better then do this !!!
        if ($verify >= "2.0.0") {
            // Load cache data and compare if version is the same or not
            $myalerts_plugins = $cache->read('mybbstuff_myalerts_alert_types');
            if ($myalerts_plugins['tradefeedback']['code'] != 'tradefeedback') {
                $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
                $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
                $alertType->setCode("tradefeedback");
                $alertType->setEnabled(true);
                $alertTypeManager->add($alertType);
            }
        }
    }
}
예제 #4
0
 /**
  * Get the users who want to receive a certain alert type.
  *
  * @param MybbStuff_MyAlerts_Entity_AlertType $alertType   The alert type
  *                                                         to check.
  * @param array                               $users       An array of User
  *                                                         IDs to check.
  * @param int                                 $findUsersBy The column to
  *                                                         find users by.
  *                                                         Should be one of
  *                                                         FIND_USERS_BY_UID
  *                                                         or
  *                                                         FIND_USERS_BY_USERNAME
  *
  * @return array
  */
 public function doUsersWantAlert(MybbStuff_MyAlerts_Entity_AlertType $alertType, array $users = array(), $findUsersBy = self::FIND_USERS_BY_UID)
 {
     $usersWhoWantAlert = array();
     switch ($findUsersBy) {
         case self::FIND_USERS_BY_USERNAME:
             $users = array_map(array($this->db, 'escape_string'), $users);
             $usernames = "'" . implode("','", $users) . "'";
             $query = $this->db->simple_select('users', 'uid, myalerts_disabled_alert_types, usergroup', "username IN({$usernames})");
             break;
         case self::FIND_USERS_BY_UID:
         default:
             $users = array_map('intval', $users);
             $uids = "'" . implode("','", $users) . "'";
             $query = $this->db->simple_select('users', 'uid, myalerts_disabled_alert_types', "uid IN({$uids})");
             break;
     }
     while ($user = $this->db->fetch_array($query)) {
         $disabledAlertTypes = @json_decode($user['myalerts_disabled_alert_types']);
         if (empty($disabledAlertTypes) || !in_array($alertType->getId(), $disabledAlertTypes) || !$alertType->getCanBeUserDisabled()) {
             $usersWhoWantAlert[] = $user;
         }
     }
     return $usersWhoWantAlert;
 }
function ffplugin_activate()
{
    global $db;
    if (!$db->table_exists("ffplugin")) {
        $db->write_query("CREATE TABLE " . TABLE_PREFIX . "ffplugin (following VARCHAR(100), follower VARCHAR(100))");
    }
    //MyAlerts stuff
    if (class_exists('MybbStuff_MyAlerts_AlertTypeManager')) {
        $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
        if (!$alertTypeManager) {
            $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
        }
        $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
        $alertType->setCode('ffplugin_myalerts');
        $alertType->setEnabled(true);
        $alertType->setCanBeUserDisabled(true);
        $alertTypeManager->add($alertType);
    }
}
    public function activate()
    {
        global $db, $cache;
        require_once MYBB_ROOT . "inc/adminfunctions_templates.php";
        $templates = array();
        $templates["myprofile_comments_content"] = '{$comments_form}
{$comment_form_script}
{$comments_table}';
        $templates["myprofile_comments_form"] = '<form action="misc.php" method="post" name="comments-form" id="comments-form">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="action" value="comments-add" />
<input type="hidden" name="memberuid" value="{$memprofile[\'uid\']}" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->mp_profile_comments_add_comment}</strong></td>
</tr>
{$status}
<tr>
<td class="trow2">
<textarea id="message" name="message" rows="10" cols="70" tabindex="2"></textarea>
{$codebuttons}
</td>
</tr>
<tr>
<td class="trow2">
<input id="submit_comment" type="submit" class="button" name="submit" value="{$lang->mp_profile_comments_add_comment}" tabindex="3" />
<span id="spinner_span"></span>
</td>
</tr>
{$modoptions}
</table>
</form>';
        $templates["myprofile_comments_form_modoptions"] = '<tr>
<td class="trow2">
<span><strong>{$lang->mp_comments_moderation} : </strong></span>
<button type="button" class="button comment-action comments-delete-all">{$lang->mp_comments_action_delete_all_comments}</button>
<span class="spinner_delete_all_span"></span>
</td>
</tr>';
        $templates["myprofile_comments_stats"] = '<tr>
<td class="trow2"><strong>{$lang->mp_profile_comments_comments}</strong></td>
<td class="trow2">{$stats_total} ({$stats_sent} {$lang->mp_comments_stats_sent} | {$stats_received} {$lang->mp_comments_stats_received})</td>
</tr>';
        $templates["myprofile_comments_form_script"] = '<script>
lang.mp_comments_comment_wrong_length = "{$lang->mp_comments_comment_wrong_length}";
lang.mp_comments_confirm_delete = "{$lang->mp_comments_confirm_delete}";
lang.mp_comments_confirm_delete_all = "{$lang->mp_comments_confirm_delete_all}";
lang.mp_comments_comment_approved_successfully = "{$lang->mp_comments_comment_approved_successfully}";
lang.mp_comments_comment_added_successfully = "{$lang->mp_comments_comment_added_successfully}";
lang.mp_comments_comment_deleted_successfully = "{$lang->mp_comments_comment_deleted_successfully}";
lang.mp_comments_comments_deleted_successfully = "{$lang->mp_comments_comments_deleted_successfully}";
lang.mp_comments_comment_edited_successfully = "{$lang->mp_comments_comment_edited_successfully}";

MyProfile.memberUid = {$comments_memberuid};
MyProfile.ajax = {$comments_ajax};
MyProfile.commentsMinLength = {$comments_minlength};
MyProfile.commentsMaxLength = {$comments_maxlength};
MyProfile.commentsSCEditor = {$comments_sceditor};
MyProfile.commentsPage = {$comments_page};
</script>';
        $templates["myprofile_comments_form_status"] = '<tr>
<td class="trow1">
<span>{$lang->mp_comments_comment_status} : </span>
<select class="{$status_select_class}" name="isprivate">
<option value="0" {$comment_public_selected}>{$lang->mp_comments_comment_public}</option>
<option value="1" {$comment_private_selected}>{$lang->mp_comments_comment_private}</option>
</select>
</td>
</tr>';
        $templates["myprofile_comments_table"] = '{$comments_separator}
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->mp_profile_comments_comments} ({$lang->mp_profile_comments_total} <span id="comments-total">{$comments_total}</span>{$useroptions})</strong></td>
</tr>
<tr class="comments-pagination">
<td colspan="2" {$comments_pagination_style}>{$comments_pagination}</td>
</tr>
<tbody class="comments-content">
{$comments_content}
</tbody>
<tr class="comments-pagination">
<td colspan="2" {$comments_pagination_style}>{$comments_pagination}</td>
</tr>
</table>
<br />';
        $templates["myprofile_comments_comment"] = '<tr width="100%" data-cid="{$comment[\'cid\']}">
<td class="trow2 {$trow_class}" rowspan="2" style="text-align: center; vertical-align: top;" data-cid="{$comment[\'cid\']}">
<img src="{$avatar_src}" {$avatar_width_height} alt />
</td>
<td style="height: 20px;" class="trow1 {$trow_class}" width="100%" data-cid="{$comment[\'cid\']}">
{$profile_link} <small style="font-size: 10px;">({$date} - {$time}) <em>{$comment_private}</em></small><br />
<span style="font-size: 10px;" data-cid="{$comment[\'cid\']}">
{$comments_approve}
{$comments_reply}
{$comments_edit}
{$comments_delete}
{$comments_report}
</span>
</td>
</tr>
<tr>
<td class="trow2 comment_message scaleimages {$trow_class}" style="max-width: 400px; overflow: hidden;" data-cid="{$comment[\'cid\']}">
{$message}
</td>
</tr>';
        $templates["myprofile_comments_no_comment"] = '<tr width="100%">
<td class="trow2">{$lang->mp_comments_no_comment_to_display}</td>
</tr>';
        $templates["myprofile_comments_comment_approve"] = '<form action="misc.php" method="post" style="display: inline;">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="action" value="comments-approve" />
<input type="hidden" name="cid" value="{$comment[\'cid\']}" />
<input type="hidden" name="memberuid" value="{$comment[\'userid\']}" />
<button class="comments-approve comments-action button" style="font-size: 11px;">{$lang->mp_comments_action_approve}</button>
</form>';
        $templates["myprofile_comments_comment_reply"] = '<form action="{$mybb->settings[\'bburl\']}/member.php" method="get" style="display: inline;">
<input type="hidden" name="action" value="profile" />
<input type="hidden" name="uid" value="{$commentor_uid}" />
<button style="font-size: 11px;">{$lang->mp_comments_action_reply}</button>
</form>';
        $templates["myprofile_comments_comment_edit"] = '<button class="comments-edit comments-action button" style="font-size: 11px;">{$lang->mp_comments_action_edit}</button>';
        $templates["myprofile_comments_comment_delete"] = '<form action="misc.php" method="post" style="display: inline;">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="action" value="comments-delete" />
<input type="hidden" name="cid" value="{$comment[\'cid\']}" />
<input type="hidden" name="memberuid" value="{$comment[\'userid\']}" />
<button class="comments-delete comments-action button" style="font-size: 11px;">{$lang->mp_comments_action_delete}</button>
</form>';
        $templates["myprofile_comments_comment_report"] = '<button class="comments-report comments-action button" style="font-size: 11px;">{$lang->mp_comments_action_report}</button>';
        $templates["myprofile_comments_report_reasons"] = '<tr>
<td class="trow1" align="left" style="width: 25%"><span class="smalltext"><strong>{$lang->report_reason}</strong></span></td>
<td class="trow1" align="left">
<select name="reason" id="report_reason">
<option value="rules">{$lang->report_reason_rules}</option>
<option value="bad">{$lang->report_reason_bad}</option>
<option value="spam">{$lang->report_reason_spam}</option>
<option value="other">{$lang->report_reason_other}</option>
</select>
</td>
</tr>
<tr id="reason">
<td class="trow2">&nbsp;</td>
<td class="trow2" align="left">
<div>{$lang->report_reason_other_description}</div>
<input type="text" class="textbox" name="comment" size="40" maxlength="250" />
</td>
</tr>
<tr>
	<td colspan="2" class="tfoot"><input type="submit" class="button" value="{$report_title}" /></td>
</tr>';
        $templates["myprofile_comments_usercp"] = '<legend><strong>{$lang->mp_my_profile}</strong></legend>
<table cellspacing="0" cellpadding="2">
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="mpcommentsopen" id="mpcommentsopen" value="1" {$mpcommentsopen} /></td>
<td><span class="smalltext"><label for="mpcommentsopen">{$lang->mp_comments_open}</label></span></td>
</tr>
<tr>
<td colspan="2"><span class="smalltext">{$lang->mp_who_can_leave_comments}</span></td>
</tr>
<tr>
<td colspan="2">
<select name="mpwhocancomment" id="mpwhocancomment">
<option value="0" {$nobodycanleavecomments}>{$lang->mp_nobody_can_leave_comments}</option>
<option value="1" {$friendlistcanleavecomment}>{$lang->mp_friendlist_can_leave_comments}</option>
<option value="2" {$anyonecanleavecomments}>{$lang->mp_anyone_can_leave_comments}</option>
</td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="mpcommentsapprove" id="mpcommentsapprove" value="1" {$mpcommentsapprove} /></td>
<td><span class="smalltext"><label for="mpcommentsapprove">{$lang->mp_comments_approve}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="mpcommentnotification" id="mpcommentnotification" value="1" {$mpcommentnotification} /></td>
<td><span class="smalltext"><label for="mpcommentnotification">{$lang->mp_comments_notification}</label></span></td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">';
        $templates["myprofile_modcp_nav_comments"] = '<tr><td class="trow1 smalltext"><a href="modcp.php?action=myprofilecomments" class="modcp_nav_item modcp_nav_ipsearch">{$lang->mp_myprofile_comments}</a></td></tr>';
        $templates["myprofile_comments_edit"] = '
<div class="modal" id="modal-edit-comments">
<div style="overflow-y: auto; max-height: 400px;" class="modal_2">
<form action="misc.php" method="post" id="comments-edit-form" name="comments-edit-form">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="hidden" name="action" value="comments-do-edit" />
<input type="hidden" name="memberuid" value="{$memprofile[\'uid\']}" />
<input type="hidden" name="no_modal" value="1" />
<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
<tr>
	<td class="thead" colspan="2"><strong>{$lang->mp_profile_comments_edit_comment}</strong></td>
</tr>
{$status}
<tr>
<td class="trow2">
<textarea id="message_edit" name="message_edit" rows="10" cols="70" tabindex="2"></textarea>
</td>
</tr>
<tr>
<td class="trow2">
<input type="submit" class="comments-edit-submit button" name="submit" value="{$lang->mp_profile_comments_edit_comment}" tabindex="3" data-cid="{$cid}" />
</td>
</tr>
</table>
</form>
<script>
$(function() {
var original_text = {$original_text};
var instance = {};
//Problem with SCEditor in new object
//if(MyProfile.commentsSCEditor) {
//$("#message_edit").sceditor(opt_editor);
//instance = $("#message_edit").sceditor(\'instance\');
//}
//else {
instance = $("#message_edit");
//}
instance.val(original_text.message);
});
</script>
</div>
</div>';
        $templates["myprofile_comments_alertbar"] = '<div class="pm_alert" id="mp_comments_notice">
<div class="float_right"><a href="#" id="mp_comments_notice_url" title="{$lang->mp_comments_dismiss_notice}"><img src="{$theme[\'imgdir\']}/dismiss_notice.png" alt="{$lang->mp_comments_dismiss_notice}" title="{$lang->mp_comments_dismiss_notice}"></a></div>
<div>{$comments_text}</div>
</div>
<script>
$(document).ready(function() {
	$(document).on("click", "a#mp_comments_notice_url", myprofile_dismiss_alertbar);
	
	function myprofile_dismiss_alertbar() {
		$.ajax({
			"url": rootpath + "/xmlhttp.php",
			"data": {
				"action" : "comments-dismiss",
				"my_post_key" : my_post_key
			},
			"type": "POST"
		});
		$("#mp_comments_notice").remove();
	}
});
</script>';
        /* - next version
            $templates["myprofile_comments_modcp_start"] = '<html>
            <head>
            <title>{$mybb->settings[\'bbname\']} - {$lang->warning_logs}</title>
            {$headerinclude}
            </head>
            <body>
            {$header}
            <table width="100%" border="0" align="center">
            <tr>
            {$modcp_nav}
            <td valign="top">
            <form action="modcp.php" method="get">
            <input type="hidden" name="action" value="warninglogs" />
            <table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
            <tr>
            <td class="thead" colspan="2"><strong>{$lang->filter_warning_logs}</strong></td>
            </tr>
            <tr>
            <td class="trow1" width="25%"><strong>{$lang->filter_warned_user}</strong></td>
            <td class="trow1" width="75%"><input type="text" name="filter[username]" id="username" value="{$mybb->input[\'filter\'][\'username\']}" class="textbox" /></td>
            </tr>
            <tr>
            <td class="trow2" width="25%"><strong>{$lang->filter_issued_by}</strong></td>
            <td class="trow2" width="75%"><input type="text" name="filter[mod_username]" value="{$mybb->input[\'filter\'][\'mod_username\']}" class="textbox" /></td>
            </tr>
            <tr>
            <td class="trow1" width="25%"><strong>{$lang->filter_reason}</strong></td>
            <td class="trow1" width="75%"><input type="text" name="filter[reason]" value="{$mybb->input[\'filter\'][\'reason\']}" class="textbox" /></td>
            </tr>
            <tr>
            <td class="trow2" width="25%"><strong>{$lang->sort_by}</strong></td>
            <td class="trow2" width="75%">
            <select name="filter[sortby]">
            <option value="username"{$sortbysel[\'username\']}>{$lang->username}</option>
            <option value="issuedby"{$sortbysel[\'issuedby\']}>{$lang->issued_by}</option>
            <option value="dateline"{$sortbysel[\'dateline\']}>{$lang->issued_date}</option>
            <option value="expires"{$sortbysel[\'expires\']}>{$lang->expiry_date}</option>
            </select>
            {$lang->in}
            <select name="filter[order]">
            <option value="asc"{$ordersel[\'asc\']}>{$lang->asc}</option>
            <option value="desc"{$ordersel[\'desc\']}>{$lang->desc}</option>
            </select>
            {$lang->order}
            </td>
            </tr>
            <tr>
            <td class="trow1" width="25%"><strong>{$lang->per_page}</strong></td>
            <td class="trow1" width="75%"><input type="text" name="filter[per_page]" value="{$per_page}" class="textbox" /></td>
            </tr>
            </table>
            <br />
            <div align="center">
            <input type="submit" class="button" value="{$lang->filter_warning_logs}" />
            </div>
            </form>
            {$multipage}
            <br />
            <form action="modcp.php" method="get">
            <input type="hidden" name="action" value="warninglogs" />
            <table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder">
            <tr>
            <td class="thead" colspan="2"><strong>{$lang->filter_warning_logs}</strong></td>
            </tr>
            <tr>
            <td class="trow1" width="25%"><strong>{$lang->filter_warned_user}</strong></td>
            <td class="trow1" width="75%"><input type="text" name="filter[username]" id="username" value="{$mybb->input[\'filter\'][\'username\']}" class="textbox" /></td>
            </tr>
            <tr>
            <td class="trow2" width="25%"><strong>{$lang->filter_issued_by}</strong></td>
            <td class="trow2" width="75%"><input type="text" name="filter[mod_username]" value="{$mybb->input[\'filter\'][\'mod_username\']}" class="textbox" /></td>
            </tr>
            <tr>
            <td class="trow1" width="25%"><strong>{$lang->filter_reason}</strong></td>
            <td class="trow1" width="75%"><input type="text" name="filter[reason]" value="{$mybb->input[\'filter\'][\'reason\']}" class="textbox" /></td>
            </tr>
            <tr>
            <td class="trow2" width="25%"><strong>{$lang->sort_by}</strong></td>
            <td class="trow2" width="75%">
            <select name="filter[sortby]">
            <option value="username"{$sortbysel[\'username\']}>{$lang->username}</option>
            <option value="issuedby"{$sortbysel[\'issuedby\']}>{$lang->issued_by}</option>
            <option value="dateline"{$sortbysel[\'dateline\']}>{$lang->issued_date}</option>
            <option value="expires"{$sortbysel[\'expires\']}>{$lang->expiry_date}</option>
            </select>
            {$lang->in}
            <select name="filter[order]">
            <option value="asc"{$ordersel[\'asc\']}>{$lang->asc}</option>
            <option value="desc"{$ordersel[\'desc\']}>{$lang->desc}</option>
            </select>
            {$lang->order}
            </td>
            </tr>
            <tr>
            <td class="trow1" width="25%"><strong>{$lang->per_page}</strong></td>
            <td class="trow1" width="75%"><input type="text" name="filter[per_page]" value="{$per_page}" class="textbox" /></td>
            </tr>
            </table>
            <br />
            <div align="center">
            <input type="submit" class="button" value="{$lang->filter_warning_logs}" />
            </div>
            </form>
            </td>
            </tr>
            </table>
            {$footer}
            <link rel="stylesheet" href="{$mybb->asset_url}/jscripts/select2/select2.css">
            <script type="text/javascript" src="{$mybb->asset_url}/jscripts/select2/select2.min.js"></script>
            <script type="text/javascript">
            <!--
            if(use_xmlhttprequest == "1")
            {
            MyBB.select2();
            $("#username").select2({
            placeholder: "{$lang->search_user}",
            minimumInputLength: 3,
            maximumSelectionSize: 3,
            multiple: false,
            ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
            url: "xmlhttp.php?action=get_users",
            dataType: \'json\',
            data: function (term, page) {
            return {
            query: term, // search term
            };
            },
            results: function (data, page) { // parse the results into the format expected by Select2.
            // since we are using custom formatting functions we do not need to alter remote JSON data
            return {results: data};
            }
            },
            initSelection: function(element, callback) {
            var value = $(element).val();
            if (value !== "") {
            callback({
            id: value,
            text: value
            });
            }
            },
            });
            }
            // -->
            </script>
            </body>
            </html>';
           */
        MyProfileUtils::insert_templates($templates);
        find_replace_templatesets("usercp_options", '#' . preg_quote('<legend><strong>{$lang->date_time_options}</strong></legend>') . '#i', '{$myprofile_comments_usercp}<legend><strong>{$lang->date_time_options}</strong></legend>');
        find_replace_templatesets("modcp_nav_users", "#" . preg_quote('{$nav_editprofile}') . "#i", '{$nav_editprofile}{$nav_myprofilecomments}');
        find_replace_templatesets("member_profile", "#" . preg_quote('{$modoptions}') . "#i", '{$modoptions}{$myprofile_comments}');
        find_replace_templatesets("member_profile", "#" . preg_quote('{$warning_level}') . "#i", '{$warning_level}{$myprofile_comments_stats}');
        find_replace_templatesets('header', "#" . preg_quote('{$unreadreports}') . "#i", '{$unreadreports}{$myprofile_alertbar}');
        /* let's integrate with MyAlerts 2.0 if it's not already the case */
        if (MyProfileUtils::myalerts_exists()) {
            if (MyProfileComments::myalerts_can_integrate()) {
                $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
                $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
                $alertType->setCode(MyProfileCommentsMyAlertsFormatter::alert_type_code());
                $alertType->setEnabled(true);
                $alertTypeManager->add($alertType);
            }
        }
    }
예제 #7
0
파일: Alert.php 프로젝트: harrygg/MyAlerts
 /**
  * @param MybbStuff_MyAlerts_Entity_AlertType $type The alert type to set.
  *
  * @return MybbStuff_Myalerts_Entity_Alert $this.
  */
 public function setType(MybbStuff_MyAlerts_Entity_AlertType $type)
 {
     $this->type = $type;
     $this->setTypeId($type->getId());
     return $this;
 }
예제 #8
0
function myalerts_upgrade_105_200()
{
    global $db, $lang, $cache, $plugins;
    if (!$db->field_exists('alert_type_id', 'alerts')) {
        $db->add_column('alerts', 'alert_type_id', 'INT(10) unsigned');
    }
    if ($db->field_exists('alert_type', 'alerts')) {
        $db->drop_column('alerts', 'alert_type');
    }
    $db->modify_column('alerts', 'dateline', 'DATETIME');
    if ($db->field_exists('tid', 'alerts')) {
        $db->rename_column('alerts', 'tid', 'object_id', 'INT(10)');
    }
    if ($db->field_exists('from_id', 'alerts')) {
        $db->rename_column('alerts', 'from_id', 'from_user_id', 'INT(10)');
    }
    // Check if the 'forced' column exists due to earlier issues with the upgrade script in past releases
    if (!$db->field_exists('forced', 'alerts')) {
        $db->add_column('alerts', 'forced', "INT(1) NOT NULL DEFAULT '0'");
    }
    if ($db->field_exists('content', 'alerts')) {
        $db->rename_column('alerts', 'content', 'extra_details', 'TEXT');
    }
    if ($db->table_exists('alert_settings')) {
        $db->drop_table('alert_settings');
    }
    if ($db->table_exists('alert_setting_values')) {
        $db->drop_table('alert_setting_values');
    }
    $collation = $db->build_create_table_collation();
    if (!$db->table_exists('alert_types')) {
        $db->write_query("CREATE TABLE " . TABLE_PREFIX . "alert_types(\n                `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n                `code` varchar(100) NOT NULL DEFAULT '',\n                `enabled` tinyint(4) NOT NULL DEFAULT '1',\n                `can_be_user_disabled` tinyint(4) NOT NULL DEFAULT '1',\n                PRIMARY KEY (`id`),\n                UNIQUE KEY `unique_code` (`code`)\n            ) ENGINE=MyISAM{$collation};");
    }
    if (!$db->field_exists('myalerts_disabled_alert_types', 'users')) {
        $db->add_column('users', 'myalerts_disabled_alert_types', 'TEXT NOT NULL');
    }
    $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
    $insertArray = array('rep', 'pm', 'buddylist', 'quoted', 'post_threadauthor', 'subscribed_thread');
    $alertTypesToAdd = array();
    foreach ($insertArray as $type) {
        $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
        $alertType->setCode($type);
        $alertType->setEnabled(true);
        $alertType->setCanBeUserDisabled(true);
        $alertTypesToAdd[] = $alertType;
    }
    $alertTypeManager->addTypes($alertTypesToAdd);
    $plugins->run_hooks('myalerts_install');
    flash_message($lang->myalerts_upgraded, 'success');
}
예제 #9
0
 /**
  * Get an alert type by it's code.
  *
  * @param string $code The code of the alert type to fetch.
  *
  * @return MybbStuff_MyAlerts_Entity_AlertType|null The found alert type or
  *                                                  null if it doesn't
  *                                                  exist (hasn't yet been
  *                                                  registered).
  */
 public function getByCode($code = '')
 {
     $code = (string) $code;
     $alertType = null;
     if (isset($this->alertTypes[$code])) {
         $alertType = MybbStuff_MyAlerts_Entity_AlertType::unserialize($this->alertTypes[$code]);
     }
     return $alertType;
 }
예제 #10
0
/**
 * MyAlerts 2.0 integration.
 *
 */
function accountswitcher_alerts_integrate()
{
    global $db, $cache, $lang;
    if (!isset($lang->aj_name)) {
        $lang->load('accountswitcher');
    }
    $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
    $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
    $alertType->setCode("accountswitcher_author");
    $alertType->setEnabled(true);
    $alertType->setCanBeUserDisabled(true);
    $alertTypeManager->add($alertType);
    $alertType->setCode("accountswitcher_pm");
    $alertType->setEnabled(true);
    $alertType->setCanBeUserDisabled(true);
    $alertTypeManager->add($alertType);
}
예제 #11
0
function thankyoulike_activate()
{
    global $mybb, $db, $cache, $lang;
    $lang->load('config_thankyoulike');
    $codename = basename(__FILE__, ".php");
    $prefix = 'g33k_' . $codename . '_';
    // Insert settings in to the database
    $query = $db->query("SELECT disporder FROM " . TABLE_PREFIX . "settinggroups ORDER BY `disporder` DESC LIMIT 1");
    $disporder = $db->fetch_field($query, 'disporder') + 1;
    $setting_group = array('name' => $prefix . 'settings', 'title' => $db->escape_string($lang->tyl_title), 'description' => $db->escape_string($lang->tyl_desc), 'disporder' => intval($disporder), 'isdefault' => 0);
    $db->insert_query('settinggroups', $setting_group);
    $gid = $db->insert_id();
    $settings = array('enabled' => array('title' => $lang->tyl_enabled_title, 'description' => $lang->tyl_enabled_desc, 'optionscode' => 'onoff', 'value' => '1'), 'thankslike' => array('title' => $lang->tyl_thankslike_title, 'description' => $lang->tyl_thankslike_desc, 'optionscode' => 'radio
thanks=Use Thank You
like=Use Like', 'value' => 'thanks'), 'firstall' => array('title' => $lang->tyl_firstall_title, 'description' => $lang->tyl_firstall_desc, 'optionscode' => 'radio
first=First Post Only
all=All Posts', 'value' => 'first'), 'firstalloverwrite' => array('title' => $lang->tyl_firstalloverwrite_title, 'description' => $lang->tyl_firstalloverwrite_desc, 'optionscode' => 'forumselect', 'value' => ''), 'removing' => array('title' => $lang->tyl_removing_title, 'description' => $lang->tyl_removing_desc, 'optionscode' => 'yesno', 'value' => '0'), 'closedthreads' => array('title' => $lang->tyl_closedthreads_title, 'description' => $lang->tyl_closedthreads_desc, 'optionscode' => 'yesno', 'value' => '0'), 'exclude' => array('title' => $lang->tyl_exclude_title, 'description' => $lang->tyl_exclude_desc, 'optionscode' => 'forumselect', 'value' => ''), 'unameformat' => array('title' => $lang->tyl_unameformat_title, 'description' => $lang->tyl_unameformat_desc, 'optionscode' => 'yesno', 'value' => '1'), 'hideforgroups' => array('title' => $lang->tyl_hideforgroups_title, 'description' => $lang->tyl_hideforgroups_desc, 'optionscode' => 'groupselect', 'value' => '1,7'), 'showdt' => array('title' => $lang->tyl_showdt_title, 'description' => $lang->tyl_showdt_desc, 'optionscode' => 'radio
none=Not Display
nexttoname=Display next to user name
astitle=Display on mouse over username', 'value' => 'astitle'), 'dtformat' => array('title' => $lang->tyl_dtformat_title, 'description' => $lang->tyl_dtformat_desc, 'optionscode' => 'text', 'value' => 'm-d-Y'), 'sortorder' => array('title' => $lang->tyl_sortorder_title, 'description' => $lang->tyl_sortorder_desc, 'optionscode' => 'select
userasc=Username Ascending
userdesc=Username Descending
dtasc=Date/Time Added Ascending
dtdesc=Date/Time Added Descending', 'value' => 'userasc'), 'collapsible' => array('title' => $lang->tyl_collapsible_title, 'description' => $lang->tyl_collapsible_desc, 'optionscode' => 'yesno', 'value' => '1'), 'colldefault' => array('title' => $lang->tyl_colldefault_title, 'description' => $lang->tyl_colldefault_desc, 'optionscode' => 'radio
open=List Shown
closed=List Hidden (Collapsed)', 'value' => 'open'), 'hidelistforgroups' => array('title' => $lang->tyl_hidelistforgroups_title, 'description' => $lang->tyl_hidelistforgroups_desc, 'optionscode' => 'groupselect', 'value' => ''), 'displaygrowl' => array('title' => $lang->tyl_displaygrowl_title, 'description' => $lang->tyl_displaygrowl_desc, 'optionscode' => 'onoff', 'value' => '1'));
    $x = 1;
    foreach ($settings as $name => $setting) {
        $insert_settings = array('name' => $db->escape_string($prefix . $name), 'title' => $db->escape_string($setting['title']), 'description' => $db->escape_string($setting['description']), 'optionscode' => $db->escape_string($setting['optionscode']), 'value' => $db->escape_string($setting['value']), 'disporder' => $x, 'gid' => $gid, 'isdefault' => 0);
        $db->insert_query('settings', $insert_settings);
        $x++;
    }
    rebuild_settings();
    require_once MYBB_ROOT . "/inc/adminfunctions_templates.php";
    find_replace_templatesets("showthread", "#" . preg_quote('</head>') . "#i", '<script type="text/javascript" src="{$mybb->settings[\'bburl\']}/jscripts/thankyoulike.min.js"></script>
<script type="text/javascript">
<!--
	var tylEnabled = "{$mybb->settings[\'g33k_thankyoulike_enabled\']}";
	var tylDisplayGrowl = "{$mybb->settings[\'g33k_thankyoulike_displaygrowl\']}";
	var tylCollapsible = "{$mybb->settings[\'g33k_thankyoulike_collapsible\']}";
	var tylUser = "******";
	var tylSend = "{$lang->tyl_send}";
	var tylRemove = "{$lang->tyl_remove}";
// -->
</script>
</head>');
    find_replace_templatesets("postbit_classic", "#" . preg_quote('<div class="post_controls">') . "#i", "<div style=\"{\$post['tyl_display']}\" id=\"tyl_{\$post['pid']}\">{\$post['thankyoulike_data']}</div>\n<div class=\"post_controls\">");
    find_replace_templatesets("postbit", "#" . preg_quote('<div class="post_controls">') . "#i", "<div style=\"{\$post['tyl_display']}\" id=\"tyl_{\$post['pid']}\">{\$post['thankyoulike_data']}</div>\n<div class=\"post_controls\">");
    find_replace_templatesets("postbit", "#" . preg_quote('{$post[\'button_edit\']}') . "#i", '{$post[\'button_tyl\']}{$post[\'button_edit\']}');
    find_replace_templatesets("postbit_classic", "#" . preg_quote('{$post[\'button_edit\']}') . "#i", '{$post[\'button_tyl\']}{$post[\'button_edit\']}');
    find_replace_templatesets("postbit_author_user", "#" . preg_quote('{$lang->postbit_threads} {$post[\'threadnum\']}<br />') . "#i", '{$lang->postbit_threads} {$post[\'threadnum\']}<br />
	%%TYL_NUMTHANKEDLIKED%%<br />');
    if (!find_replace_templatesets("member_profile", '#{\\$reputation}(\\r?)\\n#', "{\$tyl_memprofile}\n{\$reputation}\n")) {
        find_replace_templatesets("member_profile", '#{\\$reputation}(\\r?)\\n#', "{\$tyl_memprofile}\n{\$reputation}\n");
    }
    // Verify if myalerts exists and if it is compatible with 1.8.x, then add alert type
    if (function_exists("myalerts_info")) {
        // Load myalerts info into an array
        $my_alerts_info = myalerts_info();
        // Set version info to a new var
        $verify = $my_alerts_info['version'];
        // If MyAlerts 2.0 or better then do this !!!
        if ($verify >= "2.0.0") {
            // Load cache data and compare if version is the same or not
            $myalerts_plugins = $cache->read('mybbstuff_myalerts_alert_types');
            if ($myalerts_plugins['tyl']['code'] != 'tyl') {
                //Adding alert type to db
                $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
                $alertType = new MybbStuff_MyAlerts_Entity_AlertType();
                $alertType->setCode('tyl');
                $alertType->setEnabled(true);
                $alertTypeManager->add($alertType);
            }
        }
    }
}