当前位置: 首页>>代码示例>>PHP>>正文


PHP verify_post_check函数代码示例

本文整理汇总了PHP中verify_post_check函数的典型用法代码示例。如果您正苦于以下问题:PHP verify_post_check函数的具体用法?PHP verify_post_check怎么用?PHP verify_post_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了verify_post_check函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: myalerts_acp_manage_alert_types

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();
    }
}
开发者ID:harrygg,项目名称:MyAlerts,代码行数:54,代码来源:myalerts.php

示例2: myprofile_uninstall

function myprofile_uninstall()
{
    global $mybb;
    if ($mybb->request_method == 'post') {
        if (!verify_post_check($mybb->input['my_post_key'])) {
            global $lang;
            flash_message($lang->invalid_post_verify_key2, 'error');
            admin_redirect("index.php?module=config-plugins");
        }
        if (isset($mybb->input['no'])) {
            admin_redirect('index.php?module=config-plugins');
        }
        myprofile_bundles_propagate_call("uninstall");
        $mybb->cache->delete("myprofile");
        return true;
    }
    global $page;
    $page->output_confirm_action("index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=myprofile");
}
开发者ID:medbenji,项目名称:MyProfile,代码行数:19,代码来源:myprofile.php

示例3: newpoints_editpost_xmlhttp

 function newpoints_editpost_xmlhttp()
 {
     global $db, $mybb, $thread, $lang, $charset;
     if (!$mybb->user['uid']) {
         return;
     }
     if ($mybb->settings['newpoints_main_enabled'] != 1) {
         return;
     }
     if ($mybb->settings['newpoints_income_perchar'] == 0) {
         return;
     }
     if ($mybb->input['action'] != "edit_post") {
         return;
     } elseif ($mybb->input['action'] == "edit_post" && $mybb->input['do'] != 'update_post') {
         return;
     }
     if ($mybb->input['editdraft']) {
         return;
     }
     // Verify POST request
     if (!verify_post_check($mybb->input['my_post_key'], true)) {
         xmlhttp_error($lang->invalid_post_code);
     }
     $post = get_post($mybb->input['pid']);
     $fid = intval($post['fid']);
     // check forum rules
     $forumrules = newpoints_getrules('forum', $fid);
     if (!$forumrules) {
         $forumrules['rate'] = 1;
     }
     // no rule set so default income rate is 1
     // if the forum rate is 0, nothing is going to be added so let's just leave the function
     if ($forumrules['rate'] == 0) {
         return;
     }
     // check group rules - primary group check
     $grouprules = newpoints_getrules('group', $mybb->user['usergroup']);
     if (!$grouprules) {
         $grouprules['rate'] = 1;
     }
     // no rule set so default income rate is 1
     // if the group rate is 0, nothing is going to be added so let's just leave the function
     if ($grouprules['rate'] == 0) {
         return;
     }
     // get old message
     $oldpost_wo_quotes = preg_replace("/\\[quote.*?\\](.*?)\\[\\/quote\\]((\\s)*(\\[\\/quote])*)*/is", '', $post['message']);
     $oldcharcount = my_strlen($oldpost_wo_quotes);
     $message = strval($_POST['value']);
     if (my_strtolower($charset) != "utf-8") {
         if (function_exists("iconv")) {
             $message = iconv($charset, "UTF-8//IGNORE", $message);
         } else {
             if (function_exists("mb_convert_encoding")) {
                 $message = @mb_convert_encoding($message, $charset, "UTF-8");
             } else {
                 if (my_strtolower($charset) == "iso-8859-1") {
                     $message = utf8_decode($message);
                 }
             }
         }
     }
     $newpost_wo_quotes = preg_replace("/\\[quote.*?\\](.*?)\\[\\/quote\\]((\\s)*(\\[\\/quote])*)*/is", '', $message);
     $newcharcount = my_strlen($newpost_wo_quotes);
     // calculate points per character bonus
     // let's see if the number of characters in the post is greater than the minimum characters
     if ($newcharcount >= $mybb->settings['newpoints_income_minchar']) {
         // if we have more characters now
         if ($newcharcount > $oldcharcount) {
             // calculate bonus based on difference of characters
             // bonus will be positive as the new message is longer than the old one
             $bonus = ($newcharcount - $oldcharcount) * $mybb->settings['newpoints_income_perchar'];
         } elseif ($newcharcount < $oldcharcount) {
             // calculate bonus based on difference of characters
             // bonus will be positive as the new message is longer than the old one
             $bonus = ($newcharcount - $oldcharcount) * $mybb->settings['newpoints_income_perchar'];
         } elseif ($newcharcount == $oldcharcount) {
             $bonus = 0;
         }
     } else {
         // calculate bonus based on difference of characters
         // bonus will be negative as the new message is shorter than the minimum chars
         $bonus = ($newcharcount - $oldcharcount) * $mybb->settings['newpoints_income_perchar'];
     }
     // give points to the poster
     newpoints_addpoints($mybb->user['uid'], $bonus, $forumrules['rate'], $grouprules['rate'], false, true);
 }
开发者ID:ambsalinas,项目名称:anima,代码行数:88,代码来源:hooks.php

示例4: main_page

$page->add_breadcrumb_item("CloudFlare Manager", "index.php?module=cloudflare");
$page->add_breadcrumb_item("Purge Cache", "index.php?module=cloudflare-purge_cache");
$page->output_header("CloudFlare Manager - Purge Cache");
function main_page()
{
    $form = new Form('index.php?module=cloudflare-purge_cache&amp;action=purge', 'post');
    $form_container = new FormContainer('Purge Cache');
    $form_container->output_row('Purge Entire Cache', 'Remove ALL files from CloudFlare\'s cache. This will include javascript, stylesheets and images. CloudFlare can take up to 3 hours to recache resources again<br /><b>Note: </b>This may have dramatic affects on your origin server load after performing this action.', $form->generate_yes_no_radio('purge_input', 0));
    $form_container->output_row('Purge by URL', 'Granularly remove one or more files from CloudFlare\'s cache either by specifying the URL<br /><b>Note: </b><u>One</u> URL per line (max: 30)', $form->generate_text_area('urls'));
    $form_container->end();
    $buttons[] = $form->generate_submit_button('Submit');
    $form->output_submit_wrapper($buttons);
    $form->end();
}
if ($mybb->input['action'] == "purge") {
    if (!verify_post_check($mybb->input['my_post_key'])) {
        flash_message($lang->invalid_post_verify_key2, 'error');
        admin_redirect("index.php?module=cloudflare-purge_cache");
    }
    if ($mybb->input['purge_input'] == "1") {
        $request = $cloudflare->purge_cache();
        if ($request->success) {
            $page->output_success('The entire cache has been purged');
        } else {
            $page->output_error($request->errors[0]->message);
        }
    } elseif (!empty($mybb->input['urls'])) {
        $urls = explode("\n", $mybb->input['urls']);
        if (sizeof($urls) > 30) {
            $urls = array_splice($urls, 0, 30);
        }
开发者ID:dequeues,项目名称:MyBB-CloudFlare-Manager,代码行数:31,代码来源:cloudflare_purge_cache.php

示例5: eval

            eval("\$ignore_options = \"" . $templates->get("member_profile_addremove") . "\";");
            // Add/Remove Ignore
        }
        if (isset($memperms['canbereported']) && $memperms['canbereported'] == 1) {
            $add_remove_options = array('url' => "javascript:Report.reportUser({$memprofile['uid']});", 'class' => 'report_user_button', 'lang' => $lang->report_user);
            eval("\$report_options = \"" . $templates->get("member_profile_addremove") . "\";");
            // Report User
        }
    }
    $plugins->run_hooks("member_profile_end");
    eval("\$profile = \"" . $templates->get("member_profile") . "\";");
    output_page($profile);
}
if ($mybb->input['action'] == "do_emailuser" && $mybb->request_method == "post") {
    // Verify incoming POST request
    verify_post_check($mybb->get_input('my_post_key'));
    $plugins->run_hooks("member_do_emailuser_start");
    // Guests or those without permission can't email other users
    if ($mybb->usergroup['cansendemail'] == 0) {
        error_no_permission();
    }
    // Check group limits
    if ($mybb->usergroup['maxemails'] > 0) {
        if ($mybb->user['uid'] > 0) {
            $user_check = "fromuid='{$mybb->user['uid']}'";
        } else {
            $user_check = "ipaddress=" . $db->escape_binary($session->packedip);
        }
        $query = $db->simple_select("maillogs", "COUNT(*) AS sent_count", "{$user_check} AND dateline >= '" . (TIME_NOW - 60 * 60 * 24) . "'");
        $sent_count = $db->fetch_field($query, "sent_count");
        if ($sent_count >= $mybb->usergroup['maxemails']) {
开发者ID:nicopinto,项目名称:fantasitura.com,代码行数:31,代码来源:member.php

示例6: show_archive

    static function show_archive()
    {
        global $db, $mybb, $templates, $lang, $theme, $footer, $headerinclude, $header, $charset;
        $lang->load('dvz_shoutbox');
        header('Content-type: text/html; charset=' . $charset);
        add_breadcrumb($lang->dvz_sb_shoutbox, "index.php?action=shoutbox_archive");
        // moderation panel
        if (self::access_mod()) {
            if (isset($mybb->input['banlist']) && verify_post_check($mybb->input['postkey'])) {
                self::banlist_update($mybb->input['banlist']);
            }
            if (isset($mybb->input['days']) && verify_post_check($mybb->input['postkey'])) {
                if ($mybb->input['days'] == 'all') {
                    self::clear();
                } else {
                    $allowed = [2, 7, 30, 90];
                    if (in_array($mybb->input['days'], $allowed)) {
                        self::clear($mybb->input['days']);
                    }
                }
            }
            $blocked_users = htmlspecialchars_uni($mybb->settings['dvz_sb_blocked_users']);
            eval('$modoptions = "' . $templates->get("dvz_shoutbox_archive_modoptions") . '";');
        } else {
            $modoptions = null;
        }
        // pagination
        $items = self::count();
        $page = abs((int) $mybb->input['page']);
        $perPage = abs((int) $mybb->settings['dvz_sb_num_archive']);
        if ($perPage == 0) {
            $pages = 0;
        } else {
            $pages = ceil($items / $perPage);
        }
        if (!$page || $page < 1 || $page > $pages) {
            $page = 1;
        }
        $start = ($page - 1) * $perPage;
        if ($items > $perPage) {
            $multipage = multipage($items, $perPage, $page, 'index.php?action=shoutbox_archive');
        }
        $data = self::get_multiple("ORDER by s.id DESC LIMIT {$start},{$perPage}");
        $archive = null;
        while ($row = $db->fetch_array($data)) {
            $archive .= self::render_shout($row, true);
        }
        $javascript = '
<script>
dvz_shoutbox.lang = [\'' . $lang->dvz_sb_delete_confirm . '\', \'' . str_replace('{ANTIFLOOD}', (double) $mybb->settings['dvz_sb_antiflood'], $lang->dvz_sb_antiflood) . '\', \'' . $lang->dvz_sb_permissions . '\'];
</script>';
        eval('$content = "' . $templates->get("dvz_shoutbox_archive") . '";');
        output_page($content);
        exit;
    }
开发者ID:ambsalinas,项目名称:anima,代码行数:55,代码来源:dvz_shoutbox.php

示例7: cloudflare_moderation_start

function cloudflare_moderation_start()
{
    global $mybb, $db, $cache, $fid, $pid;
    if (!$mybb->settings['cloudflare_postbit_spam'] || $mybb->input['action'] != 'cloudflare_report_spam') {
        return;
    }
    if (!$mybb->input['pid']) {
        error($lang->error_invalidpost);
    }
    $pid = intval($mybb->input['pid']);
    if (!$mybb->input['fid']) {
        error($lang->error_invalidforum);
    }
    $fid = intval($mybb->input['fid']);
    if (!is_moderator($fid)) {
        error_no_permission();
    }
    $query = $db->query("\n\t\tSELECT p.uid, p.username, u.email, p.message, p.ipaddress, p.tid\n\t\tFROM " . TABLE_PREFIX . "posts p\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=p.fid)\n\t\tWHERE p.pid = '{$pid}'\n\t");
    $post = $db->fetch_array($query);
    if (!$post) {
        error($lang->error_invalidpost);
    }
    if (!$mybb->input['my_post_key']) {
        error_no_permission();
    }
    verify_post_check($mybb->input['my_post_key']);
    $spammer = get_user($post['uid']);
    $data = array("a" => $spammer['username'], "am" => $spammer['email'], "ip" => $post['ipaddress'], "con" => substr($post['message'], 0, 100));
    $data = urlencode(json_encode($data));
    cloudflare_report_spam($data);
    redirect(get_post_link($pid), "Spam successfully reported to CloudFlare. You may now ban the spammer.");
}
开发者ID:EspialWires,项目名称:MyBB-CloudFlare-Manager,代码行数:32,代码来源:cloudflare.php

示例8: xmlhttp_buddylist_page

 public function xmlhttp_buddylist_page()
 {
     global $mybb;
     $object = new stdClass();
     $object->error = false;
     $object->error_message = "";
     if (!isset($mybb->input["my_post_key"], $mybb->input["memberuid"]) || !is_string($mybb->input["my_post_key"]) || !verify_post_check($mybb->input["my_post_key"], true) || !is_numeric($mybb->input["memberuid"])) {
         return;
     }
     $page = isset($mybb->input["page"]) && is_numeric($mybb->input["page"]) && $mybb->input["page"] >= 1 ? (int) $mybb->input["page"] : 1;
     $memberuid = (int) $mybb->input["memberuid"];
     $memprofile = get_user($memberuid);
     if (empty($memprofile)) {
         return;
     }
     list($object->html, $object->count, $object->shown) = array_values($this->retrieve_buddylist_from_db($page, $memprofile));
     MyProfileUtils::output_json($object);
 }
开发者ID:medbenji,项目名称:MyProfile,代码行数:18,代码来源:myprofilebuddylist.class.php

示例9: misc_comments_do_edit

 public function misc_comments_do_edit()
 {
     global $mybb, $lang;
     if (!isset($mybb->input["my_post_key"], $mybb->input["page"], $mybb->input["memberuid"]) || !is_string($mybb->input["my_post_key"]) || !is_numeric($mybb->input["page"]) || !is_numeric($mybb->input["memberuid"])) {
         return;
     }
     if (!verify_post_check($mybb->input["my_post_key"], true)) {
         return;
     }
     MyProfileUtils::lang_load_myprofile();
     $this->redirect((int) $mybb->input["memberuid"], $lang->mp_comments_comment_edited_successfully, "&page={$mybb->input['page']}");
 }
开发者ID:medbenji,项目名称:MyProfile,代码行数:12,代码来源:myprofilecomments.class.php

示例10: send_page_headers

    send_page_headers();
}
// Do not use session system for defined pages
if (@isset($mybb->input['action']) && @isset($nosession[$mybb->input['action']]) || @isset($mybb->input['thumbnail']) && $current_page == 'attachment.php') {
    define("NO_ONLINE", 1);
}
// Create session for this user
require_once MYBB_ROOT . "inc/class_session.php";
$session = new session();
$session->init();
$mybb->session =& $session;
$mybb->user['ismoderator'] = is_moderator("", "", $mybb->user['uid']);
// Set our POST validation code here
$mybb->post_code = generate_post_check();
// Set and load the language
if (!empty($mybb->input['language']) && $lang->language_exists($mybb->input['language']) && verify_post_check($mybb->input['my_post_key'], true)) {
    $mybb->settings['bblanguage'] = $mybb->input['language'];
    // If user is logged in, update their language selection with the new one
    if ($mybb->user['uid']) {
        if ($mybb->cookies['mybblang']) {
            my_unsetcookie("mybblang");
        }
        $db->update_query("users", array("language" => $db->escape_string($mybb->settings['bblanguage'])), "uid='{$mybb->user['uid']}'");
    } else {
        my_setcookie("mybblang", $mybb->settings['bblanguage']);
    }
    $mybb->user['language'] = $mybb->settings['bblanguage'];
} else {
    if (!$mybb->user['uid'] && !empty($mybb->cookies['mybblang']) && $lang->language_exists($mybb->cookies['mybblang'])) {
        $mybb->settings['bblanguage'] = $mybb->cookies['mybblang'];
    } else {
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:global.php

示例11: run_importer

 function run_importer()
 {
     global $mybb;
     if (!($type = $mybb->get_input('ougc_awards_import'))) {
         return;
     }
     switch ($type) {
         #case 'mybbcentral';
         default:
             $tables = array('awards' => 'myawards', 'users' => 'myawards_users');
             $keys = array('name' => 'awname', 'description' => 'awdescr', 'image' => 'awimg', 'original_id' => 'awid', 'uid' => 'awuid', 'reason' => 'awreason', 'TIME_NOW' => 'awutime');
             $img_prefix = '{bburl}/uploads/awards/';
             $lang_var = 'ougc_awards_import_confirm_mybbcentral';
             break;
     }
     global $lang, $awards, $page;
     $awards->lang_load();
     if ($mybb->request_method == 'post') {
         if (!verify_post_check($mybb->input['my_post_key'])) {
             flash_message($lang->invalid_post_verify_key2, 'error');
             admin_redirect("index.php?module=config-plugins");
         }
         if (isset($mybb->input['no'])) {
             return true;
         }
         global $db;
         $query = $db->simple_select('ougc_awards', 'MAX(disporder) AS max_disporder');
         $disporder = (int) $db->fetch_field($query, 'max_disporder');
         $query = $db->simple_select($tables['awards']);
         while ($award = $db->fetch_array($query)) {
             $insert_award = array('name' => $award[$keys['name']], 'description' => $award[$keys['description']], 'image' => $img_prefix . $award[$keys['image']], 'disporder' => ++$disporder, 'pm' => '');
             $awards->insert_award($insert_award);
             $insert_award['aid'] = $awards->aid;
             $insert_award[$keys['original_id']] = $award[$keys['original_id']];
             $cache_awards[$award[$keys['original_id']]] = $insert_award;
         }
         $mybb->settings['ougc_awards_sendpm'] = $mybb->settings['enablepms'] = false;
         $query = $db->simple_select($tables['users']);
         while ($award = $db->fetch_array($query)) {
             $insert_award = array('aid' => $cache_awards[$award[$keys['original_id']]]['aid'], 'uid' => $award[$keys['uid']], 'reason' => $award[$keys['reason']], 'TIME_NOW' => $award[$keys['TIME_NOW']]);
             $awards->give_award($insert_award, array('uid' => $insert_award['uid']), $insert_award['reason']);
         }
         flash_message($lang->ougc_awards_import_end, 'success');
         admin_redirect('index.php?module=config-plugins');
     }
     $page->output_confirm_action("index.php?module=config-plugins&ougc_awards_import={$type}", $lang->{$lang_var}, $lang->ougc_awards_import_title);
 }
开发者ID:Ruwan-Ranganath,项目名称:OUGC-Awards,代码行数:47,代码来源:ougc_awards.php

示例12: shoutboxUnban

/**
 * Delete ban
 */
function shoutboxUnban()
{
    global $mybb, $db, $lang;
    if (isset($mybb->input['id']) && isset($mybb->input['token'])) {
        $lang->load('dvz_reports');
        verify_post_check($mybb->input['token']);
        $id = $db->escape_string($mybb->input['id']);
        $data = $db->write_query("select " . TABLE_PREFIX . "dvz_reports_banned.uid, " . TABLE_PREFIX . "dvz_reports_banned.id, " . TABLE_PREFIX . "users.username\r\n                from " . TABLE_PREFIX . "dvz_reports_banned\r\n                JOIN " . TABLE_PREFIX . "users ON " . TABLE_PREFIX . "dvz_reports_banned.uid = " . TABLE_PREFIX . "users.uid\r\n                WHERE " . TABLE_PREFIX . "dvz_reports_banned.id = '{$id}';");
        //Validate ban existance
        if ($data->num_rows === 0) {
            redirect('modcp.php?action=shoutbox_banned');
            die;
        }
        $data = $data->fetch_assoc();
        //Delete ban and log action
        $db->delete_query('dvz_reports_banned', 'id=' . $id);
        //Log action
        $logdata = array('uid' => htmlspecialchars_uni($data['uid']), 'username' => htmlspecialchars_uni($data['username']));
        log_moderator_action($logdata, $lang->unban_user);
        redirect('modcp.php?action=shoutbox_banned');
        die;
    }
    //Redirect
    redirect('modcp.php?action=shoutbox_banned');
    die;
}
开发者ID:noxwyll,项目名称:dvz_shoutbox_pvt,代码行数:29,代码来源:dvz_reports.php

示例13: automedia_admin


//.........这里部分代码省略.........
                                $amtable->construct_cell($i);
                                $amtable->construct_cell('<a href="' . $sub_tabs['automedia']['link'] . '&amp;action=showspecial&amp;site=' . urlencode($site) . '&amp;my_post_key=' . $mybb->post_code . '"><strong>' . $media . '</strong></a>');
                                $query = $db->simple_select('automedia', '*', "name='" . htmlspecialchars_uni($site) . "'");
                                $active = $db->fetch_array($query);
                                if ($active && $active['class'] == "special") {
                                    $amtable->construct_cell('<div style="text-align: center;"><img src="' . $mybb->asset_url . '/images/mod-on.png" width="32" height="32" alt="' . $lang->automedia_modules_success . '" />');
                                    $amtable->construct_cell('<div style="text-align: center;"><a href="' . $sub_tabs['automedia']['link'] . '&amp;action=adultdeactivate&amp;site=' . urlencode($site) . '&amp;my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_deactivate . '</strong></a></div>');
                                } else {
                                    $amtable->construct_cell('<div style="text-align: center;"><img src="' . $mybb->asset_url . '/images/mod-off.png" width="32" height="32" alt="' . $lang->automedia_modules_fail . '" />');
                                    $amtable->construct_cell('<div style="text-align: center;"><a href="' . $sub_tabs['automedia']['link'] . '&amp;action=adultactivate&amp;site=' . urlencode($site) . '&amp;my_post_key=' . $mybb->post_code . '"><strong>' . $lang->automedia_modules_activate . '</strong></a></div>');
                                }
                                $amtable->construct_row();
                                $i++;
                            }
                        }
                    }
                }
                if ($amtable->num_rows() == 0) {
                    $amtable->construct_cell($lang->automedia_adult, array('colspan' => '4'));
                    $amtable->construct_row();
                }
            } else {
                $amtable->construct_cell($lang->automedia_modules_missing_specialfolder, array('colspan' => '4'));
                $amtable->construct_row();
            }
            $amtable->output($lang->automedia_modules);
            echo '<div style="text-align: center;">
			<a href="' . $sub_tabs['automedia']['link'] . '&amp;action=activateallspecial&amp;my_post_key=' . $mybb->post_code . '"><span style="border: 3px double #0F5C8E;	padding: 3px;	background: #fff url(images/submit_bg.png) repeat-x top;	color: #0F5C8E;	margin-right: 3px;">' . $lang->automedia_modules_activateall . '</span></a>
			</div>';
            $page->output_footer();
        }
        // Activate site module
        if ($mybb->input['action'] == 'activate') {
            if (!verify_post_check($mybb->input['my_post_key'])) {
                flash_message($lang->invalid_post_verify_key2, 'error');
                admin_redirect("index.php?module=tools-automedia");
            } else {
                $site = htmlspecialchars_uni($mybb->input['site']);
                $query_act1 = $db->simple_select('automedia', '*', "name='" . $site . "'");
                $active1 = $db->fetch_array($query_act1);
                if (!$active1) {
                    $automedia_site = array("name" => $site, "class" => "site");
                    $db->insert_query("automedia", $automedia_site);
                    automedia_cache();
                    $mybb->input['module'] = $lang->av_plugin_title;
                    $mybb->input['action'] = $lang->automedia_modules_active . " ";
                    log_admin_action(ucfirst($site));
                    flash_message($lang->automedia_modules_active, 'success');
                    admin_redirect("index.php?module=tools-automedia");
                } else {
                    flash_message($lang->automedia_modules_notfound, 'error');
                }
            }
            exit;
        }
        // Activate special module
        if ($mybb->input['action'] == 'adultactivate') {
            if (!verify_post_check($mybb->input['my_post_key'])) {
                flash_message($lang->invalid_post_verify_key2, 'error');
                admin_redirect("index.php?module=tools-automedia&action=adult");
            } else {
                $site = htmlspecialchars_uni($mybb->input['site']);
                $query_act2 = $db->simple_select('automedia', '*', "name='" . $site . "'");
                $active2 = $db->fetch_array($query_act2);
                if (!$active2) {
                    $automedia_special = array("name" => $site, "class" => "special");
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:67,代码来源:automedia_admincp.php

示例14: myalerts_xmlhttp

function myalerts_xmlhttp()
{
    global $mybb, $lang, $templates, $db;
    if (!isset($lang->myalerts)) {
        $lang->load('myalerts');
    }
    myalerts_create_instances();
    if ($mybb->get_input('action') == 'getNewAlerts') {
        header('Content-Type: application/json');
        $newAlerts = MybbStuff_MyAlerts_AlertManager::getInstance()->getAlerts(0, $mybb->settings['myalerts_dropdown_limit']);
        $alertsListing = '';
        $alertsToReturn = array();
        if (is_array($newAlerts) && !empty($newAlerts)) {
            $toMarkRead = array();
            foreach ($newAlerts as $alertObject) {
                $altbg = alt_trow();
                $alert = parse_alert($alertObject);
                $alertsToReturn[] = $alert;
                if (isset($mybb->input['from']) && $mybb->input['from'] == 'header') {
                    if ($alert['message']) {
                        $alertsListing .= eval($templates->render('myalerts_alert_row_popup', true, false));
                    }
                } else {
                    if ($alert['message']) {
                        $alertsListing .= eval($templates->render('myalerts_alert_row', true, false));
                    }
                }
                $toMarkRead[] = $alertObject->getId();
            }
            MybbStuff_MyAlerts_AlertManager::getInstance()->markRead($toMarkRead);
        } else {
            $from = $mybb->get_input('from', MyBB::INPUT_STRING);
            $altbg = alt_trow();
            if (!empty($from) && $from == 'header') {
                $alertsListing = eval($templates->render('myalerts_alert_row_popup_no_alerts', true, false));
            } else {
                $alertsListing = eval($templates->render('myalerts_alert_row_no_alerts', true, false));
            }
        }
        echo json_encode(array('alerts' => $alertsToReturn, 'template' => $alertsListing));
    }
    if ($mybb->get_input('action') == 'myalerts_delete') {
        header('Content-Type: application/json');
        $id = $mybb->get_input('id', MyBB::INPUT_INT);
        $userId = (int) $mybb->user['uid'];
        $toReturn = array();
        if ($id > 0) {
            if (!verify_post_check($mybb->get_input('my_post_key'), true)) {
                $toReturn = array('errors' => array($lang->invalid_post_code));
            } else {
                $db->delete_query('alerts', "id = {$id} AND uid = {$userId}");
                $newAlerts = MybbStuff_MyAlerts_AlertManager::getInstance()->getUnreadAlerts();
                $alertsListing = '';
                $alertsToReturn = array();
                if (is_array($newAlerts) && !empty($newAlerts)) {
                    $toMarkRead = array();
                    foreach ($newAlerts as $alertObject) {
                        $altbg = alt_trow();
                        $alert = parse_alert($alertObject);
                        $alertsToReturn[] = $alert;
                        if (isset($mybb->input['from']) && $mybb->input['from'] == 'header') {
                            if ($alert['message']) {
                                $alertsListing .= eval($templates->render('myalerts_alert_row_popup', true, false));
                            }
                        } else {
                            if ($alert['message']) {
                                $alertsListing .= eval($templates->render('myalerts_alert_row', true, false));
                            }
                        }
                        $toMarkRead[] = $alertObject->getId();
                    }
                    MybbStuff_MyAlerts_AlertManager::getInstance()->markRead($toMarkRead);
                } else {
                    $from = $mybb->get_input('from', MyBB::INPUT_STRING);
                    $altbg = alt_trow();
                    if (!empty($from) && $from == 'header') {
                        $alertsListing = eval($templates->render('myalerts_alert_row_popup_no_alerts', true, false));
                    } else {
                        $alertsListing = eval($templates->render('myalerts_alert_row_no_alerts', true, false));
                    }
                }
                $toReturn = array('success' => true, 'template' => $alertsListing);
            }
        } else {
            $toReturn = array('errors' => array($lang->myalerts_error_alert_not_found));
        }
        echo json_encode($toReturn);
    }
    if ($mybb->input['action'] == 'getNumUnreadAlerts') {
        echo MybbStuff_MyAlerts_AlertManager::getInstance()->getNumUnreadAlerts();
    }
}
开发者ID:harrygg,项目名称:MyAlerts,代码行数:92,代码来源:myalerts.php

示例15: announcement_global

function announcement_global()
{
    global $announcement, $mybb, $db;
    $announcement = announcement_create(true);
    if ($mybb->input['action'] == "ann_dismiss") {
        if (!$mybb->input['id'] || $mybb->user['uid'] == 0) {
            exit;
        }
        $query = $db->simple_select("announcement", "removable, removedfrom", "ID=" . (int) $mybb->input['id']);
        $ann = $db->fetch_array($query);
        if (!$ann['removable']) {
            exit;
        }
        $removedUser = @unserialize($ann['removedfrom']);
        if ($removedUser && in_array($mybb->user['uid'], $removedUser)) {
            exit;
        }
        verify_post_check($mybb->input['my_post_key']);
        $removedUser[] = $mybb->user['uid'];
        $updated_user = array("removedfrom" => $db->escape_string(serialize($removedUser)));
        $db->update_query("announcement", $updated_user, "ID=" . (int) $mybb->input['id']);
        if ($mybb->input['ajax']) {
            echo 1;
            exit;
        } else {
            header("Location: index.php");
            exit;
        }
    }
}
开发者ID:ambsalinas,项目名称:anima,代码行数:30,代码来源:announcement.php


注:本文中的verify_post_check函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。