• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP my_unserialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 /**
  * Execute Custom Moderation Tool
  *
  * @param int $tool_id Tool ID
  * @param int|array Thread ID(s)
  * @param int|array Post ID(s)
  * @return string 'forum' or 'default' indicating where to redirect
  */
 function execute($tool_id, $tids = 0, $pids = 0)
 {
     global $db;
     // Get tool info
     $query = $db->simple_select("modtools", '*', 'tid="' . (int) $tool_id . '"');
     $tool = $db->fetch_array($query);
     if (!$tool['tid']) {
         return false;
     }
     // Format single tid and pid
     if (!is_array($tids)) {
         $tids = array($tids);
     }
     if (!is_array($pids)) {
         $pids = array($pids);
     }
     // Unserialize custom moderation
     $post_options = my_unserialize($tool['postoptions']);
     $thread_options = my_unserialize($tool['threadoptions']);
     // If the tool type is a post tool, then execute the post moderation
     $deleted_thread = 0;
     if ($tool['type'] == 'p') {
         $deleted_thread = $this->execute_post_moderation($post_options, $pids, $tids);
     }
     // Always execute thead moderation
     $this->execute_thread_moderation($thread_options, $tids);
     // If the thread is deleted, indicate to the calling script to redirect to the forum, and not the nonexistant thread
     if ($thread_options['deletethread'] == 1 || $deleted_thread === 1) {
         return 'forum';
     }
     return 'default';
 }
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:40,代码来源:class_custommoderation.php


示例2: fetch_unread_count

/**
 * Fetches the number of unread threads for the current user in a particular forum.
 *
 * @param string The forums (CSV list)
 * @return int The number of unread threads
 */
function fetch_unread_count($fid)
{
    global $cache, $db, $mybb;
    $onlyview = $onlyview2 = '';
    $permissions = forum_permissions($fid);
    $cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
    if (!empty($permissions['canonlyviewownthreads'])) {
        $onlyview = " AND uid = '{$mybb->user['uid']}'";
        $onlyview2 = " AND t.uid = '{$mybb->user['uid']}'";
    }
    if ($mybb->user['uid'] == 0) {
        $comma = '';
        $tids = '';
        $threadsread = my_unserialize($mybb->cookies['mybb']['threadread']);
        $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
        if (!empty($threadsread)) {
            foreach ($threadsread as $key => $value) {
                $tids .= $comma . intval($key);
                $comma = ',';
            }
        }
        if (!empty($tids)) {
            $count = 0;
            // We've read at least some threads, are they here?
            $query = $db->simple_select("threads", "lastpost, tid, fid", "visible=1 AND closed NOT LIKE 'moved|%' AND fid IN ({$fid}) AND lastpost > '{$cutoff}'{$onlyview}", array("limit" => 100));
            while ($thread = $db->fetch_array($query)) {
                if ($thread['lastpost'] > intval($threadsread[$thread['tid']]) && $thread['lastpost'] > intval($forumsread[$thread['fid']])) {
                    ++$count;
                }
            }
            return $count;
        }
        // Not read any threads?
        return false;
    } else {
        // START - Unread posts MOD
        $fieldname = 'dateline';
        if (function_exists("unreadPosts_is_installed") && unreadPosts_is_installed()) {
            $cutoff = $mybb->user['lastmark'];
        }
        // END - Unread posts MOD
        switch ($db->type) {
            case "pgsql":
                $query = $db->query("\n                    SELECT COUNT(t.tid) AS unread_count\n                    FROM " . TABLE_PREFIX . "threads t\n                    LEFT JOIN " . TABLE_PREFIX . "threadsread tr ON (tr.tid=t.tid AND tr.uid='{$mybb->user['uid']}')\n                    LEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=t.fid AND fr.uid='{$mybb->user['uid']}')\n                    WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' \n                        AND t.fid IN ({$fid}) \n                        AND t.lastpost > COALESCE(tr.dateline,{$cutoff}) \n                        AND t.lastpost > COALESCE(fr.dateline,{$cutoff}) \n                        AND t.lastpost > {$cutoff}\n                        {$onlyview2}\n                ");
                break;
            default:
                $query = $db->query("\n                    SELECT COUNT(t.tid) AS unread_count\n                    FROM " . TABLE_PREFIX . "threads t\n                    LEFT JOIN " . TABLE_PREFIX . "threadsread tr ON (tr.tid=t.tid AND tr.uid='{$mybb->user['uid']}')\n                    LEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=t.fid AND fr.uid='{$mybb->user['uid']}')\n                    WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' \n                        AND t.fid IN ({$fid}) \n                        AND t.lastpost > IFNULL(tr.dateline,{$cutoff}) \n                        AND t.lastpost > IFNULL(fr.dateline,{$cutoff}) \n                        AND t.lastpost > {$cutoff}\n                        {$onlyview2}\n                ");
        }
        return (int) $db->fetch_field($query, "unread_count");
    }
}
开发者ID:kpietrek,项目名称:MyBB-View_Unread_posts,代码行数:57,代码来源:functions_indicators.php


示例3: find_warnlevels_to_check

/**
 * @param resource|PDOStatement|mysqli_result $query The query to be run. Needs to select the "action" column of the "warninglevels" table
 * @param array $max_expiration_times Return variable. The maximum expiration time
 * @param array $check_levels Return variable. Whether those "levels" were checked
 */
function find_warnlevels_to_check($query, &$max_expiration_times, &$check_levels)
{
    global $db;
    // we have some warning levels we need to revoke
    $max_expiration_times = array(1 => -1, 2 => -1, 3 => -1);
    $check_levels = array(1 => false, 2 => false, 3 => false);
    while ($warn_level = $db->fetch_array($query)) {
        // revoke actions taken at this warning level
        $action = my_unserialize($warn_level['action']);
        if ($action['type'] < 1 || $action['type'] > 3) {
            continue;
        }
        $check_levels[$action['type']] = true;
        $max_exp_time =& $max_expiration_times[$action['type']];
        if ($action['length'] && $max_exp_time != 0) {
            $expiration = $action['length'];
            if ($expiration > $max_exp_time) {
                $max_exp_time = $expiration;
            }
        } else {
            $max_exp_time = 0;
        }
    }
}
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:29,代码来源:functions_warnings.php


示例4: add_breadcrumb

     $message = $lang->sprintf($lang->warning_pm_message, $user['username'], $mybb->settings['bbname']);
     $warn_errors = '';
 }
 $lang->nav_profile = $lang->sprintf($lang->nav_profile, $user['username']);
 add_breadcrumb($lang->nav_profile, get_profile_link($user['uid']));
 add_breadcrumb($lang->nav_add_warning);
 $user_link = build_profile_link($user['username'], $user['uid']);
 if ($mybb->settings['maxwarningpoints'] < 1) {
     $mybb->settings['maxwarningpoints'] = 10;
 }
 $current_level = round($user['warningpoints'] / $mybb->settings['maxwarningpoints'] * 100);
 // Fetch warning levels
 $levels = array();
 $query = $db->simple_select("warninglevels", "*");
 while ($level = $db->fetch_array($query)) {
     $level['action'] = my_unserialize($level['action']);
     switch ($level['action']['type']) {
         case 1:
             if ($level['action']['length'] > 0) {
                 $ban_length = fetch_friendly_expiration($level['action']['length']);
                 $lang_str = "expiration_" . $ban_length['period'];
                 $period = $lang->sprintf($lang->result_period, $ban_length['time'], $lang->{$lang_str});
             } else {
                 $period = $lang->result_period_perm;
             }
             $group_name = $groupscache[$level['action']['usergroup']]['title'];
             $level['friendly_action'] = $lang->sprintf($lang->result_banned, $group_name, $period);
             break;
         case 2:
             if ($level['action']['length'] > 0) {
                 $period = fetch_friendly_expiration($level['action']['length']);
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:warnings.php


示例5: array

    // Missing theme was from a forum, run a query to set any forums using the theme to the default
    if ($load_from_forum == 1) {
        $db->update_query('forums', array('style' => 0), "style = '{$style['style']}'");
    } else {
        if ($load_from_user == 1) {
            $db->update_query('users', array('style' => 0), "style = '{$mybb->user['style']}'");
        }
    }
    // Attempt to load the master or any other theme if the master is not available
    $query = $db->simple_select('themes', 'name, tid, properties, stylesheets', '', array('order_by' => 'tid', 'limit' => 1));
    $theme = $db->fetch_array($query);
}
$theme = @array_merge($theme, my_unserialize($theme['properties']));
// Fetch all necessary stylesheets
$stylesheets = '';
$theme['stylesheets'] = my_unserialize($theme['stylesheets']);
$stylesheet_scripts = array("global", basename($_SERVER['PHP_SELF']));
if (!empty($theme['color'])) {
    $stylesheet_scripts[] = $theme['color'];
}
$stylesheet_actions = array("global");
if (!empty($mybb->input['action'])) {
    $stylesheet_actions[] = $mybb->get_input('action');
}
foreach ($stylesheet_scripts as $stylesheet_script) {
    // Load stylesheets for global actions and the current action
    foreach ($stylesheet_actions as $stylesheet_action) {
        if (!$stylesheet_action) {
            continue;
        }
        if (!empty($theme['stylesheets'][$stylesheet_script][$stylesheet_action])) {
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:31,代码来源:global.php


示例6: get_admin_log_action


//.........这里部分代码省略.........
            } elseif ($logitem['data'][2] && !$logitem['data'][1]) {
                $lang_string = 'admin_log_tools_adminlog_prune_module';
            } elseif ($logitem['data'][1] && $logitem['data'][2]) {
                $lang_string = 'admin_log_tools_adminlog_prune_user_module';
            }
            break;
        case 'admin_log_tools_modlog_prune':
            // Moderator Log Pruning
            if ($logitem['data'][1] && !$logitem['data'][2]) {
                $lang_string = 'admin_log_tools_modlog_prune_user';
            } elseif ($logitem['data'][2] && !$logitem['data'][1]) {
                $lang_string = 'admin_log_tools_modlog_prune_forum';
            } elseif ($logitem['data'][1] && $logitem['data'][2]) {
                $lang_string = 'admin_log_tools_modlog_prune_user_forum';
            }
            break;
        case 'admin_log_tools_backupdb_backup':
            // Create backup
            if ($logitem['data'][0] == 'download') {
                $lang_string = 'admin_log_tools_backupdb_backup_download';
            }
            $logitem['data'][1] = '...' . substr($logitem['data'][1], -20);
            break;
        case 'admin_log_tools_backupdb_dlbackup':
            // Download backup
            $logitem['data'][0] = '...' . substr($logitem['data'][0], -20);
            break;
        case 'admin_log_tools_backupdb_delete':
            // Delete backup
            $logitem['data'][0] = '...' . substr($logitem['data'][0], -20);
            break;
        case 'admin_log_tools_optimizedb_':
            // Optimize DB
            $logitem['data'][0] = @implode(', ', my_unserialize($logitem['data'][0]));
            break;
        case 'admin_log_tools_recount_rebuild_':
            // Recount and rebuild
            $detail_lang_string = $lang_string . $logitem['data'][0];
            if (isset($lang->{$detail_lang_string})) {
                $lang_string = $detail_lang_string;
            }
            break;
            // == USERS ==
        // == USERS ==
        case 'admin_log_user_admin_permissions_edit':
            // editing default/group/user admin permissions
            if ($logitem['data'][0] > 0) {
                // User
                $lang_string .= '_user';
            } elseif ($logitem['data'][0] < 0) {
                // Group
                $logitem['data'][0] = abs($logitem['data'][0]);
                $lang_string .= '_group';
            }
            break;
        case 'admin_log_user_admin_permissions_delete':
            // deleting group/user admin permissions
            if ($logitem['data'][0] > 0) {
                // User
                $lang_string .= '_user';
            } elseif ($logitem['data'][0] < 0) {
                // Group
                $logitem['data'][0] = abs($logitem['data'][0]);
                $lang_string .= '_group';
            }
            break;
开发者ID:olada,项目名称:mybbintegrator,代码行数:67,代码来源:adminlog.php


示例7: json_encode

        $page->show_login($login_lang_string, "error");
    } else {
        // If we have this error while retreiving it from an AJAX request, then send back a nice error
        if (isset($mybb->input['ajax']) && $mybb->input['ajax'] == 1) {
            echo json_encode(array("errors" => array("login")));
            exit;
        }
        $page->show_login($login_message, "error");
    }
}
// Time to check for Two-Factor Authentication
// First: are we trying to verify a code?
if ($mybb->input['do'] == "do_2fa" && $mybb->request_method == "post") {
    // Test whether it's a recovery code
    $recovery = false;
    $codes = my_unserialize($admin_options['recovery_codes']);
    if (!empty($codes) && in_array($mybb->get_input('code'), $codes)) {
        $recovery = true;
        $ncodes = array_diff($codes, array($mybb->input['code']));
        // Removes our current code from the codes array
        $db->update_query("adminoptions", array("recovery_codes" => $db->escape_string(my_serialize($ncodes))), "uid='{$mybb->user['uid']}'");
        if (count($ncodes) == 0) {
            flash_message($lang->my2fa_no_codes, "error");
        }
    }
    // Validate the code
    require_once MYBB_ROOT . "inc/3rdparty/2fa/GoogleAuthenticator.php";
    $auth = new PHPGangsta_GoogleAuthenticator();
    $test = $auth->verifyCode($admin_options['authsecret'], $mybb->get_input('code'));
    // Either the code was okay or it was a recovery code
    if ($test === true || $recovery === true) {
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:31,代码来源:index.php


示例8: htmlspecialchars_uni

         $logitem['tsubject'] = htmlspecialchars_uni($logitem['tsubject']);
         $logitem['thread'] = get_thread_link($logitem['tid']);
         eval("\$information .= \"" . $templates->get("modcp_modlogs_result_thread") . "\";");
     }
     if ($logitem['fname']) {
         $logitem['forum'] = get_forum_link($logitem['fid']);
         eval("\$information .= \"" . $templates->get("modcp_modlogs_result_forum") . "\";");
     }
     if ($logitem['psubject']) {
         $logitem['psubject'] = htmlspecialchars_uni($logitem['psubject']);
         $logitem['post'] = get_post_link($logitem['pid']);
         eval("\$information .= \"" . $templates->get("modcp_modlogs_result_post") . "\";");
     }
     // Edited a user or managed announcement?
     if (!$logitem['tsubject'] || !$logitem['fname'] || !$logitem['psubject']) {
         $data = my_unserialize($logitem['data']);
         if ($data['uid']) {
             $information = $lang->sprintf($lang->edited_user_info, htmlspecialchars_uni($data['username']), get_profile_link($data['uid']));
         }
         if ($data['aid']) {
             $data['subject'] = htmlspecialchars_uni($data['subject']);
             $data['announcement'] = get_announcement_link($data['aid']);
             eval("\$information .= \"" . $templates->get("modcp_modlogs_result_announcement") . "\";");
         }
     }
     eval("\$modlogresults .= \"" . $templates->get("modcp_modlogs_result") . "\";");
 }
 if (!$modlogresults) {
     eval("\$modlogresults = \"" . $templates->get("modcp_modlogs_nologs") . "\";");
 }
 eval("\$latestfivemodactions = \"" . $templates->get("modcp_latestfivemodactions") . "\";");
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:modcp.php


示例9: eval

    if (!isset($stats) || isset($stats) && !is_array($stats)) {
        // Load the stats cache.
        $stats = $cache->read('stats');
    }
    $post_code_string = '';
    if ($mybb->user['uid']) {
        $post_code_string = '&amp;my_post_key=' . $mybb->post_code;
    }
    eval('$boardstats = "' . $templates->get('index_boardstats') . '";');
}
if ($mybb->user['uid'] == 0) {
    // Build a forum cache.
    $query = $db->simple_select('forums', '*', 'active!=0', array('order_by' => 'pid, disporder'));
    $forumsread = array();
    if (isset($mybb->cookies['mybb']['forumread'])) {
        $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
    }
} else {
    // Build a forum cache.
    $query = $db->query("\n\t\tSELECT f.*, fr.dateline AS lastread\n\t\tFROM " . TABLE_PREFIX . "forums f\n\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid = f.fid AND fr.uid = '{$mybb->user['uid']}')\n\t\tWHERE f.active != 0\n\t\tORDER BY pid, disporder\n\t");
}
while ($forum = $db->fetch_array($query)) {
    if ($mybb->user['uid'] == 0) {
        if (!empty($forumsread[$forum['fid']])) {
            $forum['lastread'] = $forumsread[$forum['fid']];
        }
    }
    $fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
}
$forumpermissions = forum_permissions();
// Get the forum moderators if the setting is enabled.
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:31,代码来源:index.php


示例10: array

            $table->construct_cell("{$set_popup}<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
            $table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
            $table->construct_row(array("class" => "alt_row", "id" => "group_" . $group['gid'], "name" => "group_" . $group['gid']));
        }
    }
    $table->output($template_sets[$sid]);
    $page->output_footer();
}
if (!$mybb->input['action']) {
    $plugins->run_hooks("admin_style_templates_start");
    $page->output_header($lang->template_sets);
    $page->output_nav_tabs($sub_tabs, 'templates');
    $themes = array();
    $query = $db->simple_select("themes", "name,tid,properties", "tid != '1'");
    while ($theme = $db->fetch_array($query)) {
        $tbits = my_unserialize($theme['properties']);
        $themes[$tbits['templateset']][$theme['tid']] = htmlspecialchars_uni($theme['name']);
    }
    $template_sets = array();
    $template_sets[-1]['title'] = $lang->global_templates;
    $template_sets[-1]['sid'] = -1;
    $query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title', 'order_dir' => 'ASC'));
    while ($template_set = $db->fetch_array($query)) {
        $template_sets[$template_set['sid']] = $template_set;
    }
    $table = new Table();
    $table->construct_header($lang->template_set);
    $table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));
    foreach ($template_sets as $set) {
        if ($set['sid'] == -1) {
            $table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid=-1\">{$lang->global_templates}</a></strong><br /><small>{$lang->used_by_all_themes}</small>");
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:templates.php


示例11: check_wcf1

function check_wcf1($password, $user)
{
    // WCF 1 has some special parameters, which are saved in the passwordconvert field
    $settings = my_unserialize($user['passwordconvert']);
    $user['passwordconvert'] = $settings['password'];
    if (wcf1_encrypt($user['passwordconvertsalt'] . wcf1_hash($password, $user['passwordconvertsalt'], $settings), $settings['encryption_method']) == $user['passwordconvert']) {
        return true;
    }
    return false;
}
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:10,代码来源:loginconvert.php


示例12: m_get_new_report_func

function m_get_new_report_func($xmlrpc_params)
{
    global $input, $post, $thread, $forum, $pid, $tid, $fid, $modlogdata, $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $moderation, $parser;
    $input = Tapatalk_Input::filterXmlInput(array('start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT), $xmlrpc_params);
    mod_setup();
    list($start, $limit) = process_page($input['start_num'], $input['last_num']);
    $query = $db->simple_select("moderators", "*", "(id='{$mybb->user['uid']}' AND isgroup = '0') OR (id='{$mybb->user['usergroup']}' AND isgroup = '1')");
    $numreportedposts = 0;
    while ($m_forum = $db->fetch_array($query)) {
        // For Reported posts
        if ($m_forum['canmanagereportedposts'] == 1) {
            $flist_reports .= ",'{$m_forum['fid']}'";
            $children = get_child_list($m_forum['fid']);
            if (!empty($children)) {
                $flist_reports .= ",'" . implode("','", $children) . "'";
            }
            ++$numreportedposts;
        }
    }
    // Load global language phrases
    if ($mybb->usergroup['canmanagereportedcontent'] == 0) {
        error_no_permission();
    }
    if ($numreportedposts == 0 && $mybb->usergroup['issupermod'] != 1) {
        error($lang->you_cannot_view_reported_posts);
    }
    $lang->load('report');
    add_breadcrumb($lang->mcp_nav_report_center, "modcp.php?action=reports");
    $perpage = $limit;
    if (!$perpage) {
        $perpage = 20;
    }
    $query = $db->simple_select("forums", "fid, name");
    while ($forum = $db->fetch_array($query)) {
        $forums[$forum['fid']] = $forum['name'];
    }
    // Multipage
    if ($mybb->usergroup['cancp'] || $mybb->usergroup['issupermod']) {
        $query = $db->simple_select("reportedcontent", "COUNT(rid) AS count", "reportstatus ='0'");
        $report_count = $db->fetch_field($query, "count");
    } else {
        $query = $db->simple_select('reportedcontent', 'id3', "reportstatus='0' AND (type = 'post' OR type = '')");
        $report_count = 0;
        while ($fid = $db->fetch_field($query, 'id3')) {
            if (is_moderator($fid, "canmanagereportedposts")) {
                ++$report_count;
            }
        }
        unset($fid);
    }
    $plugins->run_hooks("modcp_reports_start");
    if ($flist_reports) {
        $wflist_reports = "WHERE r.id3 IN (0{$flist_reports})";
        $tflist_reports = " AND r.id3 IN (0{$flist_reports})";
        $flist_reports = " AND id3 IN (0{$flist_reports})";
    }
    // Reports
    $reports = '';
    $query = $db->query("\n\t\tSELECT r.*, u.username\n\t\tFROM " . TABLE_PREFIX . "reportedcontent r\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (r.uid = u.uid)\n\t\tWHERE r.reportstatus = '0'{$tflist_reports}\n\t\tORDER BY r.reports DESC\n\t\tLIMIT {$start}, {$perpage}\n\t");
    if (!$db->num_rows($query)) {
        // No unread reports
        //eval("\$reports = \"".$templates->get("modcp_reports_noreports")."\";");
        $reportcache = array();
    } else {
        $reportedcontent = $cache->read("reportedcontent");
        $reportcache = $usercache = $postcache = array();
        while ($report = $db->fetch_array($query)) {
            if ($report['type'] == 'profile' || $report['type'] == 'reputation') {
                // Profile UID is in ID
                if (!isset($usercache[$report['id']])) {
                    $usercache[$report['id']] = $report['id'];
                }
                // Reputation comment? The offender is the ID2
                if ($report['type'] == 'reputation') {
                    if (!isset($usercache[$report['id2']])) {
                        $usercache[$report['id2']] = $report['id2'];
                    }
                    if (!isset($usercache[$report['id3']])) {
                        // The user who was offended
                        $usercache[$report['id3']] = $report['id3'];
                    }
                }
            } else {
                if (!$report['type'] || $report['type'] == 'post') {
                    // This (should) be a post
                    $postcache[$report['id']] = $report['id'];
                }
            }
            // Lastpost info - is it missing (pre-1.8)?
            $lastposter = $report['uid'];
            if (!$report['lastreport']) {
                // Last reporter is our first reporter
                $report['lastreport'] = $report['dateline'];
            }
            if ($report['reporters']) {
                $reporters = my_unserialize($report['reporters']);
                if (is_array($reporters)) {
                    $lastposter = end($reporters);
                }
            }
//.........这里部分代码省略.........
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:101,代码来源:moderation.php


示例13: htmlspecialchars_uni

 $event['usertitle'] = htmlspecialchars_uni($event['usertitle']);
 if ($event['ignoretimezone'] == 0) {
     $offset = $event['timezone'];
 } else {
     $offset = $mybb->user['timezone'];
 }
 $event['starttime_user'] = $event['starttime'] + $offset * 3600;
 // Events over more than one day
 $time_period = '';
 if ($event['endtime'] > 0 && $event['endtime'] != $event['starttime']) {
     $event['endtime_user'] = $event['endtime'] + $offset * 3600;
     $start_day = gmmktime(0, 0, 0, gmdate("n", $event['starttime_user']), gmdate("j", $event['starttime_user']), gmdate("Y", $event['starttime_user']));
     $end_day = gmmktime(0, 0, 0, gmdate("n", $event['endtime_user']), gmdate("j", $event['endtime_user']), gmdate("Y", $event['endtime_user']));
     $start_time = gmdate("Hi", $event['starttime_user']);
     $end_time = gmdate("Hi", $event['endtime_user']);
     $event['repeats'] = my_unserialize($event['repeats']);
     // Event only runs over one day
     if ($start_day == $end_day && $event['repeats']['repeats'] == 0) {
         $time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']);
         // Event runs all day
         if ($start_time != 00 && $end_time != 2359) {
             $time_period .= $lang->comma . gmdate($mybb->settings['timeformat'], $event['starttime_user']) . " - " . gmdate($mybb->settings['timeformat'], $event['endtime_user']);
         } else {
             $time_period .= $lang->comma . $lang->all_day;
         }
     } else {
         $time_period = gmdate($mybb->settings['dateformat'], $event['starttime_user']) . ", " . gmdate($mybb->settings['timeformat'], $event['starttime_user']);
         $time_period .= " - ";
         $time_period .= gmdate($mybb->settings['dateformat'], $event['endtime_user']) . ", " . gmdate($mybb->settings['timeformat'], $event['endtime_user']);
     }
 } else {
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:calendar.php


示例14: get_announcement_list

function get_announcement_list($foruminfo, $fid)
{
    // Gather forum stats
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $time, $mybbgroups, $cache;
    $has_announcements = $has_modtools = false;
    $forum_stats = $cache->read("forumsdisplay");
    $parser = new postParser();
    if (is_array($forum_stats)) {
        if (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$fid]['modtools'])) {
            // Mod tools are specific to forums, not parents
            $has_modtools = true;
        }
        if (!empty($forum_stats[-1]['announcements']) || !empty($forum_stats[$fid]['announcements'])) {
            // Global or forum-specific announcements
            $has_announcements = true;
        }
    }
    $parentlist = $foruminfo['parentlist'];
    $parentlistexploded = explode(",", $parentlist);
    foreach ($parentlistexploded as $mfid) {
        if (!empty($forum_stats[$mfid]['announcements'])) {
            $has_announcements = true;
        }
    }
    $announcementlist = $topic_list = array();
    if ($has_announcements == true) {
        $limit = '';
        $announcements = '';
        if ($mybb->settings['announcementlimit']) {
            $limit = "LIMIT 0, " . $mybb->settings['announcementlimit'];
        }
        $sql = build_parent_list($fid, "fid", "OR", $parentlist);
        $time = TIME_NOW;
        $query = $db->query("\n\t\t\tSELECT a.*, u.username\n\t\t\tFROM " . TABLE_PREFIX . "announcements a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=a.uid)\n\t\t\tWHERE a.startdate<='{$time}' AND (a.enddate>='{$time}' OR a.enddate='0') AND ({$sql} OR fid='-1')\n\t\t\tORDER BY a.startdate DESC {$limit}\n\t\t");
        // See if this announcement has been read in our announcement array
        $cookie = array();
        if (isset($mybb->cookies['mybb']['announcements'])) {
            $cookie = my_unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
        }
        $announcementlist = '';
        $bgcolor = alt_trow(true);
        // Reset the trow colors
        while ($announcement = $db->fetch_array($query)) {
            if ($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']]) {
                $new_class = ' class="subject_new"';
                $folder = "newfolder";
            } else {
                $new_class = ' class="subject_old"';
                $folder = "folder";
            }
            // Mmm, eat those announcement cookies if they're older than our last visit
            if (isset($cookie[$announcement['aid']]) && $cookie[$announcement['aid']] < $mybb->user['lastvisit']) {
                unset($cookie[$announcement['aid']]);
            }
            $announcement['announcementlink'] = get_announcement_link($announcement['aid']);
            $announcement['subject'] = $parser->parse_badwords($announcement['subject']);
            $announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
            $postdate = my_date('relative', $announcement['startdate']);
            $announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);
            $announcementlist[] = $announcement;
        }
        if (empty($cookie)) {
            // Clean up cookie crumbs
            my_setcookie('mybb[announcements]', 0, TIME_NOW - 60 * 60 * 24 * 365);
        } else {
            if (!empty($cookie)) {
                my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);
            }
        }
        foreach ($announcementlist as $announce) {
            $user_info = get_user($announce['uid']);
            $icon_url = absolute_url($user_info['avatar']);
            $xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($fid, 'string'), 'topic_id' => new xmlrpcval('ann_' . $announce['aid'], 'string'), 'topic_title' => new xmlrpcval(basic_clean($announce['subject']), 'base64'), 'topic_author_id' => new xmlrpcval($announce['uid'], 'string'), 'topic_author_name' => new xmlrpcval(basic_clean($announce['username']), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($icon_url), 'string'), 'reply_number' => new xmlrpcval(0, 'int'), 'view_number' => new xmlrpcval(0, 'int'), 'short_content' => new xmlrpcval(process_short_content($announce['message'], $parser), 'base64')), 'struct');
            $topic_list[] = $xmlrpc_topic;
        }
    }
    $response = new xmlrpcval(array('total_topic_num' => new xmlrpcval(count($announcementlist), 'int'), 'forum_id' => new xmlrpcval($fid), 'forum_name' => new xmlrpcval(basic_clean($foruminfo['name']), 'base64'), 'can_post' => new xmlrpcval(false, 'boolean'), 'can_upload' => new xmlrpcval(false, 'boolean'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
    return new xmlrpcresp($response);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:79,代码来源:get_topic.php


示例15: get_upgrade_store

function get_upgrade_store($title)
{
    global $db;
    $query = $db->simple_select("upgrade_data", "*", "title='" . $db->escape_string($title) . "'");
    $data = $db->fetch_array($query);
    return my_unserialize($data['contents']);
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:7,代码来源:upgrade.php


示例16: my_set_array_cookie

/**
 * Set a serialised cookie array.
 *
 * @param string The cookie identifier.
 * @param int The cookie content id.
 * @param string The value to set the cookie to.
 */
function my_set_array_cookie($name, $id, $value, $expires = "")
{
    global $mybb;
    $cookie = $mybb->cookies['mybb'];
    $newcookie = my_unserialize($cookie[$name]);
    $newcookie[$id] = $value;
    $newcookie = serialize($newcookie);
    my_setcookie("mybb[{$name}]", addslashes($newcookie), $expires);
    // Make sure our current viarables are up-to-date as well
    $mybb->cookies['mybb'][$name] = $newcookie;
}
开发者ID:khanfusiion,项目名称:mybb,代码行数:18,代码来源:functions.php


示例17: array

 $table->construct_header($lang->spam_username, array('width' => '20%'));
 $table->construct_header($lang->spam_email, array("class" => "align_center", 'width' => '20%'));
 $table->construct_header($lang->spam_ip, array("class" => "align_center", 'width' => '20%'));
 $table->construct_header($lang->spam_date, array("class" => "align_center", 'width' => '20%'));
 $table->construct_header($lang->spam_confidence, array("class" => "align_center", 'width' => '20%'));
 $query = $db->simple_select("spamlog", "*", $where, array('order_by' => $sortby, 'order_dir' => $order, 'limit_start' => $start, 'limit' => $perpage));
 while ($row = $db->fetch_array($query)) {
     $username = htmlspecialchars_uni($row['username']);
     $email = htmlspecialchars_uni($row['email']);
     $ip_address = my_inet_ntop($db->unescape_binary($row['ipaddress']));
     $dateline = '';
     if ($row['dateline'] > 0) {
         $dateline = my_date('relative', $row['dateline']);
     }
     $confidence = '0%';
     $data = @my_unserialize($row['data']);
     if (is_array($data) && !empty($data)) {
         if (isset($data['confidence'])) {
             $confidence = (double) $data['confidence'] . '%';
         }
     }
     $table->construct_cell($username);
     $table->construct_cell($email);
     $table->construct_cell($ip_address);
     $table->construct_cell($dateline);
     $table->construct_cell($confidence);
     $table->construct_row();
 }
 if ($table->num_rows() == 0) {
     $table->construct_cell($lang->no_spam_logs, array("colspan" => "5"));
     $table->construct_row();
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:spamlog.php


示例18: task_delayedmoderation

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_delayedmoderation($task)
{
    global $db, $lang, $plugins;
    require_once MYBB_ROOT . "inc/class_moderation.php";
    $moderation = new Moderation();
    require_once MYBB_ROOT . "inc/class_custommoderation.php";
    $custommod = new CustomModeration();
    // Iterate through all our delayed moderation actions
    $query = $db->simple_select("delayedmoderation", "*", "delaydateline <= '" . TIME_NOW . "'");
    while ($delayedmoderation = $db->fetch_array($query)) {
        if (is_object($plugins)) {
            $args = array('task' => &$task, 'delayedmoderation' => &$delayedmoderation);
            $plugins->run_hooks('task_delayedmoderation', $args);
        }
        $tids = explode(',', $delayedmoderation['tids']);
        $input = my_unserialize($delayedmoderation['inputs']);
        if (my_strpos($delayedmoderation['type'], "modtool") !== false) {
            list(, $custom_id) = explode('_', $delayedmoderation['type'], 2);
            $custommod->execute($custom_id, $tids);
        } else {
            switch ($delayedmoderation['type']) {
                case "openclosethread":
                    $closed_tids = $open_tids = array();
                    $query2 = $db->simple_select("threads", "tid,closed", "tid IN({$delayedmoderation['tids']})");
                    while ($thread = $db->fetch_array($query2)) {
                        if ($thread['closed'] == 1) {
                            $closed_tids[] = $thread['tid'];
                        } else {
                            $open_tids[] = $thread['tid'];
                        }
                    }
                    if (!empty($closed_tids)) {
                        $moderation->open_threads($closed_tids);
                    }
                    if (!empty($open_tids)) {
                        $moderation->close_threads($open_tids);
                    }
                    break;
                case "deletethread":
                    foreach ($tids as $tid) {
                        $moderation->delete_thread($tid);
                    }
                    break;
                case "move":
                    foreach ($tids as $tid) {
                        $moderation->move_thread($tid, $input['new_forum']);
                    }
                    break;
                case "stick":
                    $unstuck_tids = $stuck_tids = array();
                    $query2 = $db->simple_select("threads", "tid,sticky", "tid IN({$delayedmoderation['tids']})");
                    while ($thread = $db->fetch_array($query2)) {
                        if ($thread['sticky'] == 1) {
                            $stuck_tids[] = $thread['tid'];
                        } else {
                            $unstuck_tids[] = $thread['tid'];
                        }
                    }
                    if (!empty($stuck_tids)) {
                        $moderation->unstick_threads($stuck_tids);
                    }
                    if (!empty($unstuck_tids)) {
                        $moderation->stick_threads($unstuck_tids);
                    }
                    break;
                case "merge":
                    // $delayedmoderation['tids'] should be a single tid
                    if (count($tids) != 1) {
                        continue;
                    }
                    // explode at # sign in a url (indicates a name reference 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP my_unsetcookie函数代码示例发布时间:2022-05-15
下一篇:
PHP my_thread_log函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap