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


PHP update_pm_count函数代码示例

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


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

示例1: task_dailycleanup

/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id$
 */
function task_dailycleanup($task)
{
    global $mybb, $db, $cache, $lang;
    require_once MYBB_ROOT . "inc/functions_user.php";
    // Clear out sessions older than 24h
    $cut = TIME_NOW - 60 * 60 * 24;
    $db->delete_query("sessions", "time < '{$cut}'");
    // Delete old read topics
    if ($mybb->settings['threadreadcut'] > 0) {
        $cut = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
        $db->delete_query("threadsread", "dateline < '{$cut}'");
        $db->delete_query("forumsread", "dateline < '{$cut}'");
    }
    // Check PMs moved to trash over a week ago & delete them
    $timecut = TIME_NOW - 60 * 60 * 24 * 7;
    $query = $db->simple_select("privatemessages", "pmid, uid, folder", "deletetime<='{$timecut}' AND folder='4'");
    while ($pm = $db->fetch_array($query)) {
        $user_update[$pm['uid']] = $uid;
        $pm_update[] = $pm['pmid'];
    }
    if (!empty($pm_update)) {
        $db->delete_query("privatemessages", "pmid IN(" . implode(',', $pm_update) . ")");
    }
    if (!empty($user_update)) {
        foreach ($user_update as $uid) {
            update_pm_count($uid);
        }
    }
    $cache->update_most_replied_threads();
    $cache->update_most_viewed_threads();
    $cache->update_birthdays();
    $cache->update_forumsdisplay();
    add_task_log($task, $lang->task_dailycleanup_ran);
}
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:43,代码来源:dailycleanup.php

示例2: mark_pm_unread_func

function mark_pm_unread_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $input = Tapatalk_Input::filterXmlInput(array('message_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    $foldernames = array();
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
        $foldernames[$folderinfo[0]] = $folderinfo[1];
    }
    $sql_array = array("status" => 0, "readtime" => 0);
    $db->update_query("privatemessages", $sql_array, "pmid='{$input['message_id']}' AND uid='" . $mybb->user['uid'] . "'");
    update_pm_count();
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:33,代码来源:mark_pm_unread.php

示例3: task_dailycleanup

/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_dailycleanup($task)
{
    global $mybb, $db, $cache, $lang, $plugins;
    require_once MYBB_ROOT . "inc/functions_user.php";
    $time = array('sessionstime' => TIME_NOW - 60 * 60 * 24, 'threadreadcut' => TIME_NOW - (int) $mybb->settings['threadreadcut'] * 60 * 60 * 24, 'privatemessages' => TIME_NOW - 60 * 60 * 24 * 7, 'deleteinvite' => TIME_NOW - (int) $mybb->settings['deleteinvites'] * 60 * 60 * 24, 'stoppmtracking' => TIME_NOW - 60 * 60 * 24 * 180);
    if (is_object($plugins)) {
        $args = array('task' => &$task, 'time' => &$time);
        $plugins->run_hooks('task_dailycleanup_start', $args);
    }
    // Clear out sessions older than 24h
    $db->delete_query("sessions", "time < '" . (int) $time['sessionstime'] . "'");
    // Delete old read topics
    if ($mybb->settings['threadreadcut'] > 0) {
        $db->delete_query("threadsread", "dateline < '" . (int) $time['threadreadcut'] . "'");
        $db->delete_query("forumsread", "dateline < '" . (int) $time['threadreadcut'] . "'");
    }
    // Check PMs moved to trash over a week ago & delete them
    $query = $db->simple_select("privatemessages", "pmid, uid, folder", "deletetime<='" . (int) $time['privatemessages'] . "' AND folder='4'");
    while ($pm = $db->fetch_array($query)) {
        $user_update[$pm['uid']] = 1;
        $pm_update[] = $pm['pmid'];
    }
    // Delete old group invites
    if ($mybb->settings['deleteinvites'] > 0) {
        $db->delete_query("joinrequests", "dateline < '" . (int) $time['deleteinvite'] . "' AND invite='1'");
    }
    // Stop tracking read PMs after 6 months
    $sql_array = array("receipt" => 0);
    $db->update_query("privatemessages", $sql_array, "receipt='2' AND folder!='3' AND status!='0' AND readtime < '" . (int) $time['stoppmtracking'] . "'");
    if (is_object($plugins)) {
        $args = array('user_update' => &$user_update, 'pm_update' => &$pm_update);
        $plugins->run_hooks('task_dailycleanup_end', $args);
    }
    if (!empty($pm_update)) {
        $db->delete_query("privatemessages", "pmid IN(" . implode(',', $pm_update) . ")");
    }
    if (!empty($user_update)) {
        foreach ($user_update as $uid) {
            update_pm_count($uid);
        }
    }
    $cache->update_most_replied_threads();
    $cache->update_most_viewed_threads();
    $cache->update_birthdays();
    $cache->update_forumsdisplay();
    add_task_log($task, $lang->task_dailycleanup_ran);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:55,代码来源:dailycleanup.php

示例4: get_quote_pm_func

function get_quote_pm_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    require_once MYBB_ROOT . $mybb->settings['tapatalk_directory'] . '/emoji/emoji.class.php';
    $input = Tapatalk_Input::filterXmlInput(array('message_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    $foldernames = array();
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
        $foldernames[$folderinfo[0]] = $folderinfo[1];
    }
    if ($mybb->usergroup['cansendpms'] == 0) {
        return tt_no_permission();
    }
    $query = $db->query("\n\t\tSELECT pm.*, u.username AS quotename\n\t\tFROM " . TABLE_PREFIX . "privatemessages pm\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=pm.fromid)\n\t\tWHERE pm.pmid='{$input['message_id']}' AND pm.uid='" . $mybb->user['uid'] . "'\n\t");
    $pm = $db->fetch_array($query);
    $message = $pm['message'];
    $subject = $pm['subject'];
    $subject = preg_replace("#(FW|RE):( *)#is", '', $subject);
    $message = "[quote={$pm['quotename']}]\n{$message}\n[/quote]";
    $message = preg_replace('#^/me (.*)$#im', "* " . $pm['quotename'] . " \\1", $message);
    $subject = "Re: {$subject}";
    $result = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'msg_id' => new xmlrpcval($pm['pmid'], 'string'), 'msg_subject' => new xmlrpcval($subject, 'base64'), 'text_body' => new xmlrpcval(tapatalkEmoji::covertNameToEmoji($message), 'base64')), 'struct');
    return new xmlrpcresp($result);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:43,代码来源:get_quote_pm.php

示例5: create_message_func

function create_message_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $pminfo, $pm;
    $input = Tapatalk_Input::filterXmlInput(array('user_name' => Tapatalk_Input::RAW, 'subject' => Tapatalk_Input::STRING, 'text_body' => Tapatalk_Input::STRING, 'action' => Tapatalk_Input::INT, 'pm_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    if ($mybb->usergroup['cansendpms'] == 0) {
        return tt_no_permission();
    }
    $pmhandler = new PMDataHandler();
    $pm = array("subject" => $input['subject'], "message" => $input['text_body'], "icon" => 0, "fromid" => $mybb->user['uid'], "do" => $input['action'] == 1 ? 'reply' : 'forward', "pmid" => $input['pm_id']);
    $pm['to'] = array_map("trim", $input['user_name']);
    $pm['options'] = array("signature" => 0, "disablesmilies" => 0, "savecopy" => 1, "readreceipt" => 0);
    $pmhandler->set_data($pm);
    if (!$pmhandler->validate_pm()) {
        $pm_errors = $pmhandler->get_friendly_errors();
        return xmlrespfalse(implode(" :: ", $pm_errors));
    } else {
        $pminfo = $pmhandler->insert_pm();
        $plugins->run_hooks("private_do_send_end");
    }
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:38,代码来源:create_message.php

示例6: delete_message_func

function delete_message_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $input = Tapatalk_Input::filterXmlInput(array('message_id' => Tapatalk_Input::INT, 'box_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    $foldernames = array();
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
        $foldernames[$folderinfo[0]] = $folderinfo[1];
    }
    $query = $db->simple_select("privatemessages", "*", "pmid='{$input['message_id']}' AND uid='" . $mybb->user['uid'] . "' AND folder='4'", array('order_by' => 'pmid'));
    if ($db->num_rows($query) == 1) {
        $db->delete_query("privatemessages", "pmid='{$input['message_id']}'");
    } else {
        $sql_array = array("folder" => 4, "deletetime" => TIME_NOW);
        $db->update_query("privatemessages", $sql_array, "pmid='{$input['message_id']}' AND uid='" . $mybb->user['uid'] . "'");
    }
    update_pm_count();
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:38,代码来源:delete_message.php

示例7: eval

     }
     eval("\$pmsdownload .= \"" . $templates->get("private_archive_" . $mybb->input['exporttype'] . "_message", 1, 0) . "\";");
     $ids .= ",'{$message['pmid']}'";
 }
 if ($mybb->input['exporttype'] == "html") {
     // Gather global stylesheet for HTML
     $query = $db->simple_select("themestylesheets", "stylesheet", "sid = '1'", array('limit' => 1));
     $css = $db->fetch_field($query, "stylesheet");
 }
 $plugins->run_hooks("private_do_export_end");
 eval("\$archived = \"" . $templates->get("private_archive_" . $mybb->input['exporttype'], 1, 0) . "\";");
 if ($mybb->get_input('deletepms', MyBB::INPUT_INT) == 1) {
     // delete the archived pms
     $db->delete_query("privatemessages", "pmid IN ('0'{$ids})");
     // Update PM count
     update_pm_count();
 }
 if ($mybb->input['exporttype'] == "html") {
     $filename = "pm-archive.html";
     $contenttype = "text/html";
 } elseif ($mybb->input['exporttype'] == "csv") {
     $filename = "pm-archive.csv";
     $contenttype = "application/octet-stream";
 } else {
     $filename = "pm-archive.txt";
     $contenttype = "text/plain";
 }
 $archived = str_replace("\\\\'", "'", $archived);
 header("Content-disposition: filename={$filename}");
 header("Content-type: " . $contenttype);
 if ($mybb->input['exporttype'] == "html") {
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:private.php

示例8: mark_all_forums_read

/**
 * Marks all forums as read.
 *
 */
function mark_all_forums_read()
{
    global $mybb, $db, $cache;
    // Can only do "true" tracking for registered users
    if ($mybb->user['uid'] > 0) {
        $db->update_query("users", array('lastvisit' => TIME_NOW), "uid='" . $mybb->user['uid'] . "'");
        require_once MYBB_ROOT . "inc/functions_user.php";
        update_pm_count('', 2);
        if ($mybb->settings['threadreadcut'] > 0) {
            // Need to loop through all forums and mark them as read
            $forums = $cache->read('forums');
            $update_count = ceil(count($forums) / 20);
            if ($update_count < 15) {
                $update_count = 15;
            }
            $mark_query = '';
            $done = 0;
            foreach (array_keys($forums) as $fid) {
                switch ($db->type) {
                    case "pgsql":
                    case "sqlite":
                        $mark_query[] = array('fid' => $fid, 'uid' => $mybb->user['uid'], 'dateline' => TIME_NOW);
                        break;
                    default:
                        if ($mark_query != '') {
                            $mark_query .= ',';
                        }
                        $mark_query .= "('{$fid}', '{$mybb->user['uid']}', '" . TIME_NOW . "')";
                }
                ++$done;
                // Only do this in loops of $update_count, save query time
                if ($done % $update_count) {
                    switch ($db->type) {
                        case "pgsql":
                        case "sqlite":
                            foreach ($mark_query as $replace_query) {
                                add_shutdown(array($db, "replace_query"), array("forumsread", $replace_query, array("fid", "uid")));
                            }
                            $mark_query = array();
                            break;
                        default:
                            $db->shutdown_query("\n\t\t\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "forumsread (fid, uid, dateline)\n\t\t\t\t\t\t\t\tVALUES {$mark_query}\n\t\t\t\t\t\t\t");
                            $mark_query = '';
                    }
                }
            }
            if ($mark_query != '') {
                switch ($db->type) {
                    case "pgsql":
                    case "sqlite":
                        foreach ($mark_query as $replace_query) {
                            add_shutdown(array($db, "replace_query"), array("forumsread", $replace_query, array("fid", "uid")));
                        }
                        break;
                    default:
                        $db->shutdown_query("\n\t\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "forumsread (fid, uid, dateline)\n\t\t\t\t\t\t\tVALUES {$mark_query}\n\t\t\t\t\t\t");
                }
            }
        }
    } else {
        my_setcookie("mybb[readallforums]", 1);
        my_setcookie("mybb[lastvisit]", TIME_NOW);
        my_unsetcookie("mybb[threadread]");
        my_unsetcookie("mybb[forumread]");
    }
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:70,代码来源:functions_indicators.php

示例9: load_user

 /**
  * Load a user via the user credentials.
  *
  * @param int The user id.
  * @param string The user's password.
  */
 function load_user($uid, $password = '')
 {
     global $mybb, $db, $time, $lang, $mybbgroups, $session, $cache;
     // Read the banned cache
     $bannedcache = $cache->read("banned");
     // If the banned cache doesn't exist, update it and re-read it
     if (!is_array($bannedcache)) {
         $cache->update_banned();
         $bannedcache = $cache->read("banned");
     }
     $uid = intval($uid);
     $query = $db->query("\n\t\t\tSELECT u.*, f.*\n\t\t\tFROM " . TABLE_PREFIX . "users u \n\t\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid) \n\t\t\tWHERE u.uid='{$uid}'\n\t\t\tLIMIT 1\n\t\t");
     $mybb->user = $db->fetch_array($query);
     $this->logins = $mybb->user['loginattempts'];
     $this->failedlogin = $mybb->user['failedlogin'];
     if ($bannedcache[$uid]) {
         $banned_user = $bannedcache[$uid];
         $mybb->user['bandate'] = $banned_user['dateline'];
         $mybb->user['banlifted'] = $banned_user['lifted'];
         $mybb->user['banoldgroup'] = $banned_user['oldgroup'];
         $mybb->user['banolddisplaygroup'] = $banned_user['olddisplaygroup'];
         $mybb->user['banoldadditionalgroups'] = $banned_user['oldadditionalgroups'];
     }
     // Check the password if we're not using a session
     if ($password != $mybb->user['loginkey'] || !$mybb->user['uid']) {
         unset($mybb->user);
         $this->uid = 0;
         return false;
     }
     $this->uid = $mybb->user['uid'];
     // Set the logout key for this user
     $mybb->user['logoutkey'] = md5($mybb->user['loginkey']);
     // Sort out the private message count for this user.
     if (($mybb->user['totalpms'] == -1 || $mybb->user['unreadpms'] == -1) && $mybb->settings['enablepms'] != 0) {
         $update = 0;
         if ($mybb->user['totalpms'] == -1) {
             $update += 1;
         }
         if ($mybb->user['unreadpms'] == -1) {
             $update += 2;
         }
         require_once MYBB_ROOT . "inc/functions_user.php";
         $pmcount = update_pm_count('', $update);
         if (is_array($pmcount)) {
             $mybb->user = array_merge($mybb->user, $pmcount);
         }
     }
     $mybb->user['pms_total'] = $mybb->user['totalpms'];
     $mybb->user['pms_unread'] = $mybb->user['unreadpms'];
     if ($mybb->user['lastip'] != $this->ipaddress && array_key_exists('lastip', $mybb->user)) {
         $lastip_add .= ", lastip='" . $db->escape_string($this->ipaddress) . "', longlastip='" . intval(ip2long($this->ipaddress)) . "'";
     }
     // If the last visit was over 900 seconds (session time out) ago then update lastvisit.
     $time = TIME_NOW;
     if ($time - $mybb->user['lastactive'] > 900) {
         $db->shutdown_query("UPDATE " . TABLE_PREFIX . "users SET lastvisit='{$mybb->user['lastactive']}', lastactive='{$time}' {$lastip_add} WHERE uid='{$mybb->user['uid']}'");
         $mybb->user['lastvisit'] = $mybb->user['lastactive'];
         require_once MYBB_ROOT . "inc/functions_user.php";
         update_pm_count('', 2);
     } else {
         $timespent = TIME_NOW - $mybb->user['lastactive'];
         $db->shutdown_query("UPDATE " . TABLE_PREFIX . "users SET lastactive='{$time}', timeonline=timeonline+{$timespent} {$lastip_add} WHERE uid='{$mybb->user['uid']}'");
     }
     // Sort out the language and forum preferences.
     if ($mybb->user['language'] && $lang->language_exists($mybb->user['language'])) {
         $mybb->settings['bblanguage'] = $mybb->user['language'];
     }
     if ($mybb->user['dateformat'] != 0 && $mybb->user['dateformat'] != '') {
         global $date_formats;
         if ($date_formats[$mybb->user['dateformat']]) {
             $mybb->settings['dateformat'] = $date_formats[$mybb->user['dateformat']];
         }
     }
     // Choose time format.
     if ($mybb->user['timeformat'] != 0 && $mybb->user['timeformat'] != '') {
         global $time_formats;
         if ($time_formats[$mybb->user['timeformat']]) {
             $mybb->settings['timeformat'] = $time_formats[$mybb->user['timeformat']];
         }
     }
     // Find out the threads per page preference.
     if ($mybb->user['tpp']) {
         $mybb->settings['threadsperpage'] = $mybb->user['tpp'];
     }
     // Find out the posts per page preference.
     if ($mybb->user['ppp']) {
         $mybb->settings['postsperpage'] = $mybb->user['ppp'];
     }
     // Does this user prefer posts in classic mode?
     if ($mybb->user['classicpostbit']) {
         $mybb->settings['postlayout'] = 'classic';
     } else {
         $mybb->settings['postlayout'] = 'horizontal';
     }
//.........这里部分代码省略.........
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:101,代码来源:class_session.php

示例10: get_box_func

function get_box_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $input = Tapatalk_Input::filterXmlInput(array('box_id' => Tapatalk_Input::INT, 'start_num' => Tapatalk_Input::INT, 'last_num' => Tapatalk_Input::INT), $xmlrpc_params);
    list($start, $limit) = process_page($input['start_num'], $input['last_num']);
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    $foldernames = array();
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
        $foldernames[$folderinfo[0]] = $folderinfo[1];
    }
    if (!$input['box_id'] || !array_key_exists($input['box_id'], $foldernames)) {
        $input['box_id'] = 1;
    }
    $folder = $input['box_id'];
    $foldername = $foldernames[$folder];
    $lang->pms_in_folder = $lang->sprintf($lang->pms_in_folder, $foldername);
    if ($folder == 2 || $folder == 3) {
        $sender = $lang->sentto;
    } else {
        $sender = $lang->sender;
    }
    // Do Multi Pages
    $query = $db->simple_select("privatemessages", "COUNT(*) AS total", "uid='" . $mybb->user['uid'] . "' AND folder='{$folder}'");
    $count_total = $db->fetch_field($query, 'total');
    $query = $db->simple_select("privatemessages", "COUNT(*) AS unread", "uid='" . $mybb->user['uid'] . "' AND folder='{$folder}' AND readtime = 0");
    $count_unread = $db->fetch_field($query, 'unread');
    // Get all recipients into an array
    $cached_users = $get_users = array();
    $users_query = $db->simple_select("privatemessages", "recipients", "folder='{$folder}' AND uid='{$mybb->user['uid']}'", array('limit_start' => $start, 'limit' => $limit, 'order_by' => 'dateline', 'order_dir' => 'DESC'));
    while ($row = $db->fetch_array($users_query)) {
        $recipients = unserialize($row['recipients']);
        if (is_array($recipients['to']) && count($recipients['to'])) {
            $get_users = array_merge($get_users, $recipients['to']);
        }
        if (is_array($recipients['bcc']) && count($recipients['bcc'])) {
            $get_users = array_merge($get_users, $recipients['bcc']);
        }
    }
    $get_users = implode(',', array_unique($get_users));
    // Grab info
    if ($get_users) {
        $users_query = $db->simple_select("users", "uid, username, usergroup, displaygroup", "uid IN ({$get_users})");
        while ($user = $db->fetch_array($users_query)) {
            $cached_users[$user['uid']] = $user;
        }
    }
    $user_online = $folder == 1 ? ', fu.lastactive, fu.invisible, fu.lastvisit ' : ', tu.lastactive, tu.invisible, tu.lastvisit ';
    $query = $db->query("\n\t\tSELECT pm.*, fu.username AS fromusername, tu.username as tousername, fu.avatar as favatar, tu.avatar as tavatar {$user_online}\n\t\tFROM " . TABLE_PREFIX . "privatemessages pm\n\t\tLEFT JOIN " . TABLE_PREFIX . "users fu ON (fu.uid=pm.fromid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "users tu ON (tu.uid=pm.toid)\n\t\tWHERE pm.folder='{$folder}' AND pm.uid='" . $mybb->user['uid'] . "'\n\t\tORDER BY pm.dateline DESC\n\t\tLIMIT {$start}, {$limit}\n\t");
    $message_list = array();
    if ($db->num_rows($query) > 0) {
        while ($message = $db->fetch_array($query)) {
            $status = 1;
            if ($message['status'] == 0) {
                $msgalt = $lang->new_pm;
            } elseif ($message['status'] == 1) {
                $msgalt = $lang->old_pm;
                $status = 2;
            } elseif ($message['status'] == 3) {
                $msgalt = $lang->reply_pm;
                $status = 3;
            } elseif ($message['status'] == 4) {
                $msgalt = $lang->fwd_pm;
                $status = 4;
            }
            $msg_from = null;
            $msg_to = array();
            $avatar = "";
            $outboxdisplayuserid = 0;
            // Sent Items or Drafts Folder Check
            $recipients = unserialize($message['recipients']);
            if (count($recipients['to']) > 1 || count($recipients['to']) == 1 && count($recipients['bcc']) > 0) {
                foreach ($recipients['to'] as $uid) {
                    $profilelink = get_profile_link($uid);
                    $user = $cached_users[$uid];
                    if (!empty($user['username'])) {
                        $msg_to[] = new xmlrpcval(array("username" => new xmlrpcval($user['username'], "base64"), "user_id" => new xmlrpcval($uid, "string"), "user_type" => check_return_user_type($user['username'])), "struct");
                    }
                    if (($folder == 2 or $folder == 3) && !$outboxdisplayuserid) {
                        $outboxdisplayuserid = $uid;
                    }
                }
//.........这里部分代码省略.........
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:101,代码来源:get_box.php

示例11: deletePrivateMessagesOfUser

 /**
  * Flag all private messages of a user as deleted
  * It is also possible to flag pms as deleted of multiple users, when paramater is an array with IDs
  *
  * @param integer|array $pm_id ID(s) of User IDs (many IDs require an array)
  */
 function deletePrivateMessagesOfUser($user_id)
 {
     require_once MYBB_ROOT . 'inc/functions_user.php';
     $this->plugins->run_hooks('private_delete_start');
     $data = array('folder' => 4, 'deletetime' => TIME_NOW);
     if (is_array($user_id)) {
         $this->db->update_query('privatemessages', $data, 'uid IN (' . implode(',', array_map('intval', $user_id)) . ')');
     } else {
         $this->db->update_query('privatemessages', $data, 'uid = ' . intval($user_id));
     }
     update_pm_count();
     $this->plugins->run_hooks('private_delete_end');
 }
开发者ID:NoiSek,项目名称:ArFlux,代码行数:19,代码来源:class.MyBBIntegrator.php

示例12: acp_recount_private_messages

/**
 * Recount private messages (total and unread) for users
 */
function acp_recount_private_messages()
{
    global $db, $mybb, $lang;
    $query = $db->simple_select("users", "COUNT(uid) as num_users");
    $num_users = $db->fetch_field($query, 'num_users');
    $page = $mybb->get_input('page', MyBB::INPUT_INT);
    $per_page = $mybb->get_input('privatemessages', MyBB::INPUT_INT);
    if ($per_page <= 0) {
        $per_page = 500;
    }
    $start = ($page - 1) * $per_page;
    $end = $start + $per_page;
    require_once MYBB_ROOT . "inc/functions_user.php";
    $query = $db->simple_select("users", "uid", '', array('order_by' => 'uid', 'order_dir' => 'asc', 'limit_start' => $start, 'limit' => $per_page));
    while ($user = $db->fetch_array($query)) {
        update_pm_count($user['uid']);
    }
    check_proceed($num_users, $end, ++$page, $per_page, "privatemessages", "do_recountprivatemessages", $lang->success_rebuilt_private_messages);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:22,代码来源:recount_rebuild.php

示例13: insert_pm


//.........这里部分代码省略.........
     $query = $db->simple_select("privatemessages", "pmid, deletetime", "folder='3' AND uid='" . intval($pm['sender']['uid']) . "' AND pmid='{$pm['pmid']}'");
     $draftcheck = $db->fetch_array($query);
     // This PM was previously a draft
     if ($draftcheck['pmid']) {
         if ($draftcheck['deletetime']) {
             // This draft was a reply to a PM
             $pm['pmid'] = $draftcheck['deletetime'];
             $pm['do'] = "reply";
         }
         // Delete the old draft as we no longer need it
         $db->delete_query("privatemessages", "pmid='{$draftcheck['pmid']}'");
     }
     // Saving this message as a draft
     if ($pm['saveasdraft']) {
         $this->pm_insert_data['uid'] = $pm['sender']['uid'];
         // If this is a reply, then piggyback into the deletetime to let us know in the future
         if ($pm['do'] == "reply" || $pm['do'] == "replyall") {
             $this->pm_insert_data['deletetime'] = $pm['pmid'];
         }
         $plugins->run_hooks("datahandler_pm_insert_updatedraft", $this);
         $db->insert_query("privatemessages", $this->pm_insert_data);
         // If this is a draft, end it here - below deals with complete messages
         return array("draftsaved" => 1);
     }
     // Save a copy of the PM for each of our recipients
     foreach ($pm['recipients'] as $recipient) {
         // Send email notification of new PM if it is enabled for the recipient
         $query = $db->simple_select("privatemessages", "dateline", "uid='" . $recipient['uid'] . "' AND folder='1'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 1));
         $lastpm = $db->fetch_array($query);
         if ($recipient['pmnotify'] == 1 && $recipient['lastactive'] > $lastpm['dateline']) {
             if ($recipient['language'] != "" && $lang->language_exists($recipient['language'])) {
                 $uselang = $recipient['language'];
             } elseif ($mybb->settings['bblanguage']) {
                 $uselang = $mybb->settings['bblanguage'];
             } else {
                 $uselang = "english";
             }
             if ($uselang == $mybb->settings['bblanguage'] && !empty($lang->emailsubject_newpm)) {
                 $emailsubject = $lang->emailsubject_newpm;
                 $emailmessage = $lang->email_newpm;
             } else {
                 $userlang = new MyLanguage();
                 $userlang->set_path(MYBB_ROOT . "inc/languages");
                 $userlang->set_language($uselang);
                 $userlang->load("messages");
                 $emailsubject = $userlang->emailsubject_newpm;
                 $emailmessage = $userlang->email_newpm;
             }
             if (!$pm['sender']['username']) {
                 $pm['sender']['username'] = $lang->mybb_engine;
             }
             $emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
             $emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname']);
             $new_email = array("mailto" => $db->escape_string($recipient['email']), "mailfrom" => '', "subject" => $db->escape_string($emailsubject), "message" => $db->escape_string($emailmessage), "headers" => '');
             $db->insert_query("mailqueue", $new_email);
             $cache->update_mailqueue();
         }
         $this->pm_insert_data['uid'] = $recipient['uid'];
         $this->pm_insert_data['toid'] = $recipient['uid'];
         $plugins->run_hooks("datahandler_pm_insert", $this);
         $this->pmid = $db->insert_query("privatemessages", $this->pm_insert_data);
         // If PM noices/alerts are on, show!
         if ($recipient['pmnotice'] == 1) {
             $updated_user = array("pmnotice" => 2);
             $db->update_query("users", $updated_user, "uid='{$recipient['uid']}'");
         }
         // Update private message count (total, new and unread) for recipient
         require_once MYBB_ROOT . "/inc/functions_user.php";
         update_pm_count($recipient['uid'], 7, $recipient['lastactive']);
     }
     // Are we replying or forwarding an existing PM?
     if ($pm['pmid']) {
         if ($pm['do'] == "reply" || $pm['do'] == "replyall") {
             $sql_array = array('status' => 3, 'statustime' => TIME_NOW);
             $db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
         } elseif ($pm['do'] == "forward") {
             $sql_array = array('status' => 4, 'statustime' => TIME_NOW);
             $db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
         }
     }
     // If we're saving a copy
     if ($pm['options']['savecopy'] != 0) {
         if (isset($recipient_list['to']) && count($recipient_list['to']) == 1) {
             $this->pm_insert_data['toid'] = $uid;
         } else {
             $this->pm_insert_data['toid'] = 0;
         }
         $this->pm_insert_data['uid'] = intval($pm['sender']['uid']);
         $this->pm_insert_data['folder'] = 2;
         $this->pm_insert_data['status'] = 1;
         $this->pm_insert_data['receipt'] = 0;
         $plugins->run_hooks("datahandler_pm_insert_savedcopy", $this);
         $db->insert_query("privatemessages", $this->pm_insert_data);
         // Because the sender saved a copy, update their total pm count
         require_once MYBB_ROOT . "/inc/functions_user.php";
         update_pm_count($pm['sender']['uid'], 1);
     }
     // Return back with appropriate data
     return array("messagesent" => 1);
 }
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:101,代码来源:pm.php

示例14: get_message_func

function get_message_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $input = Tapatalk_Input::filterXmlInput(array('message_id' => Tapatalk_Input::INT, 'box_id' => Tapatalk_Input::INT, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    $foldernames = array();
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $folderinfo[1] = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
        $foldernames[$folderinfo[0]] = $folderinfo[1];
    }
    $pmid = $input['message_id'];
    $query = $db->query("\n\t\tSELECT pm.*, u.*, f.*, g.title AS grouptitle, g.usertitle AS groupusertitle, g.stars AS groupstars, g.starimage AS groupstarimage, g.image AS groupimage, g.namestyle\n\t\tFROM " . TABLE_PREFIX . "privatemessages pm\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=pm.fromid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (g.gid=u.usergroup)\n\t\tWHERE pm.pmid='{$pmid}' AND pm.uid='" . $mybb->user['uid'] . "'\n\t");
    $pm = $db->fetch_array($query);
    if ($pm['folder'] == 3) {
        return xmlrespfalse("Draft PMs are not supported by Tapatalk");
    }
    if (!$pm['pmid']) {
        return xmlrespfalse($lang->error_invalidpm);
    }
    $parser = new Tapatalk_Parser();
    $parser_options = array();
    $parser_options['allow_html'] = false;
    $parser_options['allow_mycode'] = true;
    $parser_options['allow_smilies'] = false;
    $parser_options['allow_imgcode'] = true;
    $parser_options['allow_videocode'] = true;
    $parser_options['nl2br'] = (bool) $input['return_html'];
    $parser_options['filter_badwords'] = 1;
    $pm['message'] = post_bbcode_clean($pm['message']);
    $pm['message'] = $parser->parse_message($pm['message'], $parser_options);
    if ($pm['receipt'] == 1) {
        if ($mybb->usergroup['cantrackpms'] == 1 && $mybb->usergroup['candenypmreceipts'] == 1 && $mybb->input['denyreceipt'] == 1) {
            $receiptadd = 0;
        } else {
            $receiptadd = 2;
        }
    }
    if ($pm['status'] == 0) {
        $time = TIME_NOW;
        $updatearray = array('status' => 1, 'readtime' => $time);
        if (isset($receiptadd)) {
            $updatearray['receipt'] = $receiptadd;
        }
        $db->update_query('privatemessages', $updatearray, "pmid='{$pmid}'");
        // Update the unread count - it has now changed.
        update_pm_count($mybb->user['uid'], 6);
        // Update PM notice value if this is our last unread PM
        if ($mybb->user['unreadpms'] - 1 <= 0 && $mybb->user['pmnotice'] == 2) {
            $updated_user = array("pmnotice" => 1);
            $db->update_query("users", $updated_user, "uid='{$mybb->user['uid']}'");
        }
    }
    $pm['subject'] = $parser->parse_badwords($pm['subject']);
    if ($pm['fromid'] == 0) {
        $pm['username'] = $lang->mybb_engine;
    }
    if (!$pm['username']) {
        $pm['username'] = $lang->na;
    }
    // Fetch the recipients for this message
    $pm['recipients'] = @unserialize($pm['recipients']);
    if (is_array($pm['recipients']['to'])) {
        $uid_sql = implode(',', $pm['recipients']['to']);
        foreach ($pm['recipients']['to'] as $uid) {
            $user = get_user($uid);
            $msg_to_list[] = new xmlrpcval(array('user_id' => new xmlrpcval($user['uid'], 'string'), 'username' => new xmlrpcval(basic_clean($user['username']), 'base64'), 'user_type' => check_return_user_type($user['username'])), 'struct');
            if (($pm['folder'] == 2 or $pm['folder'] == 3) && !$avatar) {
                $avatar = $user['avatar'];
            }
        }
    } else {
        $user = get_user($pm['toid']);
        $msg_to_list[] = new xmlrpcval(array('user_id' => new xmlrpcval($user['uid'], 'string'), 'username' => new xmlrpcval(basic_clean($user['username']), 'base64'), 'user_type' => check_return_user_type($user['username'])), 'struct');
        if ($pm['folder'] == 2 or $pm['folder'] == 3) {
            $avatar = $user['avatar'];
        }
    }
    $show_bcc = 0;
    // If we have any BCC recipients and this user is an Administrator, add them on to the query
    if (count($pm['recipients']['bcc']) > 0 && $mybb->usergroup['cancp'] == 1) {
        foreach ($pm['recipients']['bcc'] as $uid) {
            $user = get_user($uid);
//.........这里部分代码省略.........
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:101,代码来源:get_message.php

示例15: get_box_info_func

function get_box_info_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $lang->load("private");
    $parser = new postParser();
    if ($mybb->settings['enablepms'] == 0) {
        return xmlrespfalse($lang->pms_disabled);
    }
    if ($mybb->user['uid'] == '/' || $mybb->user['uid'] == 0 || $mybb->usergroup['canusepms'] == 0) {
        return tt_no_permission();
    }
    if (!$mybb->user['pmfolders']) {
        $mybb->user['pmfolders'] = "1**\$%%\$2**\$%%\$3**\$%%\$4**";
        $sql_array = array("pmfolders" => $mybb->user['pmfolders']);
        $db->update_query("users", $sql_array, "uid = " . $mybb->user['uid']);
    }
    $rand = my_rand(0, 9);
    if ($rand == 5) {
        update_pm_count();
    }
    $foldercache = array();
    $folderids = array();
    $folderlist = '';
    $foldersexploded = explode("\$%%\$", $mybb->user['pmfolders']);
    foreach ($foldersexploded as $key => $folders) {
        $folderinfo = explode("**", $folders, 2);
        $foldername = $folderinfo[1];
        $fid = $folderinfo[0];
        $foldername = get_pm_folder_name($fid, $foldername);
        $type = "";
        if ($fid == 1) {
            $type = "INBOX";
        } else {
            if ($fid == 2) {
                $type = "SENT";
            } else {
                continue;
            }
        }
        // return inbox and send box only
        $foldercache[$fid] = array("fid" => $fid, "name" => $foldername, "total" => 0, "unread" => 0, "type" => $type);
        $folderids[] = intval($fid);
    }
    $query = $db->simple_select("privatemessages", "folder, count(*) as total", "FIND_IN_SET(folder, '" . implode(",", $folderids) . "') AND uid='{$mybb->user['uid']}' group by folder");
    while ($folder = $db->fetch_array($query)) {
        $foldercache[$folder['folder']]['total'] = $folder['total'];
    }
    $query = $db->simple_select("privatemessages", "folder, count(*) as unread", "FIND_IN_SET(folder, '" . implode(",", $folderids) . "') AND uid='{$mybb->user['uid']}' AND readtime = 0 group by folder");
    while ($folder = $db->fetch_array($query)) {
        $foldercache[$folder['folder']]['unread'] = $folder['unread'];
    }
    $folder_list = array();
    foreach ($foldercache as $fid => $folder) {
        $folder_list[] = new xmlrpcval(array('box_id' => new xmlrpcval($fid, 'string'), 'box_name' => new xmlrpcval($folder['name'], 'base64'), 'msg_count' => new xmlrpcval($folder['total'], 'int'), 'unread_count' => new xmlrpcval($folder['unread'], 'int'), 'box_type' => new xmlrpcval($folder['type'], 'string')), 'struct');
    }
    $spaceused = 0;
    if ($mybb->usergroup['pmquota'] != '0' && $mybb->usergroup['cancp'] != 1) {
        $query = $db->simple_select("privatemessages", "COUNT(*) AS total", "uid='" . $mybb->user['uid'] . "'");
        $pmscount = $db->fetch_array($query);
        if ($pmscount['total'] > 0) {
            $spaceused = $mybb->usergroup['pmquota'] - $pmscount['total'];
        }
    }
    $result = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'message_room_count' => new xmlrpcval($mybb->usergroup['cancp'] == 1 ? 100 : $spaceused, 'int'), 'list' => new xmlrpcval($folder_list, 'array')), 'struct');
    return $result;
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:66,代码来源:get_box_info.php


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