本文整理汇总了PHP中my_get_array_cookie函数的典型用法代码示例。如果您正苦于以下问题:PHP my_get_array_cookie函数的具体用法?PHP my_get_array_cookie怎么用?PHP my_get_array_cookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_get_array_cookie函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
} else {
$forum_read = intval(my_get_array_cookie("forumread", $fid));
}
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) {
$cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($thread['lastpost'] > $cutoff) {
if ($thread_read) {
$lastread = $thread_read;
} else {
// Set $lastread to zero to make sure 'lastpost' is invoked in the last IF
$lastread = 0;
}
}
}
if (!$lastread) {
$readcookie = $threadread = intval(my_get_array_cookie("threadread", $thread['tid']));
if ($readcookie > $forum_read) {
$lastread = $readcookie;
} else {
$lastread = $forum_read;
}
}
if ($cutoff && $lastread < $cutoff) {
$lastread = $cutoff;
}
// Next, find the proper pid to link to.
$options = array("limit_start" => 0, "limit" => 1, "order_by" => "dateline", "order_dir" => "asc");
$lastread = intval($lastread);
$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline > '{$lastread}' {$visibleonly}", $options);
$newpost = $db->fetch_array($query);
if ($newpost['pid'] && $lastread) {
示例2: get_forum_lightbulb
/**
* Fetch the status indicator for a forum based on its last post and the read date
*
* @param array Array of information about the forum
* @param array Array of information about the lastpost date
* @return array Array of the folder image to be shown and the alt text
*/
function get_forum_lightbulb($forum, $lastpost, $locked = 0)
{
global $mybb, $lang, $db, $unread_forums;
// This forum is closed, so override the folder icon with the "offlock" icon.
if ($forum['open'] == 0 || $locked) {
$folder = "offlock";
$altonoff = $lang->forum_locked;
} else {
// Fetch the last read date for this forum
if ($forum['lastread']) {
$forum_read = $forum['lastread'];
} else {
$forum_read = my_get_array_cookie("forumread", $forum['fid']);
}
if (!$forum_read) {
$forum_read = $mybb->user['lastvisit'];
}
// If the lastpost is greater than the last visit and is greater than the forum read date, we have a new post
if ($lastpost['lastpost'] > $forum_read && $lastpost['lastpost'] != 0) {
$unread_forums++;
$folder = "on";
$altonoff = $lang->new_posts;
} else {
$folder = "off";
$altonoff = $lang->no_new_posts;
}
}
return array("folder" => $folder, "altonoff" => $altonoff);
}
示例3: my_get_array_cookie
$read_cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($forum_read == 0 || $forum_read < $read_cutoff) {
$forum_read = $read_cutoff;
}
}
if ($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read) {
$cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
}
$cutoff = 0;
if ($thread['lastpost'] > $cutoff) {
if ($thread['lastread']) {
$lastread = $thread['lastread'];
}
}
if (!$lastread) {
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if ($readcookie > $forum_read) {
$lastread = $readcookie;
} else {
$lastread = $forum_read;
}
}
// Folder Icons
if ($thread['doticon']) {
$folder = "dot_";
$folder_label .= $lang->icon_dot;
}
if ($thread['lastpost'] > $lastread && $lastread) {
$folder .= "new";
$folder_label .= $lang->icon_new;
$new_class = "subject_new";
示例4: get_topic_func
//.........这里部分代码省略.........
if ($tids) {
$tids = implode(",", $tids);
}
if ($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $threadcache) {
$query = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");
while ($post = $db->fetch_array($query)) {
if ($moved_threads[$post['tid']]) {
$post['tid'] = $moved_threads[$post['tid']];
}
if ($threadcache[$post['tid']]) {
$threadcache[$post['tid']]['doticon'] = 1;
}
}
}
if ($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0 && $threadcache) {
$query = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");
while ($readthread = $db->fetch_array($query)) {
if ($moved_threads[$readthread['tid']]) {
$readthread['tid'] = $moved_threads[$readthread['tid']];
}
if ($threadcache[$readthread['tid']]) {
$threadcache[$readthread['tid']]['lastread'] = $readthread['dateline'];
}
}
}
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
$query = $db->simple_select("forumsread", "dateline", "fid='{$fid}' AND uid='{$mybb->user['uid']}'");
$forum_read = $db->fetch_field($query, "dateline");
$read_cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($forum_read == 0 || $forum_read < $read_cutoff) {
$forum_read = $read_cutoff;
}
} else {
$forum_read = my_get_array_cookie("forumread", $fid);
}
$threads = '';
$load_inline_edit_js = 0;
$topic_list = array();
if (is_array($threadcache)) {
reset($threadcache);
foreach ($threadcache as $thread) {
$unreadpost = false;
$moved = explode("|", $thread['closed']);
$thread['author'] = $thread['uid'];
if (!$thread['username']) {
$thread['username'] = $thread['threadusername'];
$thread['profilelink'] = $thread['threadusername'];
} else {
$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);
}
// If this thread has a prefix, insert a space between prefix and subject
if ($thread['prefix'] != 0) {
$threadprefix = build_prefixes($thread['prefix']);
$thread['displayprefix'] = $threadprefix['displaystyle'];
}
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$prefix = '';
if ($thread['poll']) {
$prefix = $lang->poll_prefix;
}
$thread['posts'] = $thread['replies'] + 1;
if ($moved[0] == "moved") {
$prefix = $lang->moved_prefix;
$thread['replies'] = "-";
$thread['views'] = "-";
}
示例5: get_forum_lightbulb
/**
* Fetch the status indicator for a forum based on its last post and the read date
*
* @param array Array of information about the forum
* @param array Array of information about the lastpost date
* @return array Array of the folder image to be shown and the alt text
*/
function get_forum_lightbulb($forum, $lastpost, $locked = 0)
{
global $mybb, $lang, $db, $unread_forums;
// This forum is closed, so override the folder icon with the "offlock" icon.
if ($forum['open'] == 0 || $locked) {
$folder = "offlock";
$altonoff = $lang->forum_locked;
} else {
// Fetch the last read date for this forum
if (!empty($forum['lastread'])) {
$forum_read = $forum['lastread'];
} elseif (!empty($mybb->cookies['mybb']['readallforums'])) {
// We've hit the read all forums as a guest, so use the lastvisit of the user
$forum_read = $mybb->cookies['mybb']['lastvisit'];
} else {
$forum_read = 0;
$threadcut = TIME_NOW - 60 * 60 * 24 * $mybb->settings['threadreadcut'];
// If the user is a guest, do they have a forumsread cookie?
if (!$mybb->user['uid'] && $mybb->cookies['mybb']['forumread']) {
// If they've visited us before, then they'll have this cookie - otherwise everything is unread...
$forum_read = my_get_array_cookie("forumread", $forum['fid']);
} else {
if ($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0 && $threadcut > $lastpost['lastpost']) {
// We have a user, the forum's unread and we're over our threadreadcut limit for the lastpost - we mark these as read
$forum_read = $lastpost['lastpost'] + 1;
}
}
}
//if(!$forum_read)
//{
//$forum_read = $mybb->user['lastvisit'];
//}
// If the lastpost is greater than the last visit and is greater than the forum read date, we have a new post
if ($lastpost['lastpost'] > $forum_read && $lastpost['lastpost'] != 0) {
$unread_forums++;
$folder = "on";
$altonoff = $lang->new_posts;
} else {
$folder = "off";
$altonoff = $lang->no_new_posts;
}
}
return array("folder" => $folder, "altonoff" => $altonoff);
}
示例6: my_get_array_cookie
$folder_label = '';
if (isset($thread['doticon'])) {
$folder = "dot_";
$folder_label .= $lang->icon_dot;
}
$gotounread = '';
$isnew = 0;
$donenew = 0;
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) {
if (!empty($thread['lastread'])) {
$last_read = $thread['lastread'];
} else {
$last_read = $read_cutoff;
}
} else {
$last_read = my_get_array_cookie("threadread", $thread['tid']);
}
if ($forum_read > $last_read) {
$last_read = $forum_read;
}
if ($thread['lastpost'] > $last_read && $moved[0] != "moved") {
$folder .= "new";
$folder_label .= $lang->icon_new;
$new_class = "subject_new";
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"" . $templates->get("forumdisplay_thread_gotounread") . "\";");
$unreadpost = 1;
} else {
$folder_label .= $lang->icon_no_new;
$new_class = "subject_old";
}
示例7: get_subscribed_topic_func
//.........这里部分代码省略.........
$visible = "AND t.visible != 0";
if (is_moderator() == true) {
$visible = '';
}
// Do Multi Pages
$query = $db->query("\n\t\tSELECT COUNT(ts.tid) as threads\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions ts\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid = ts.tid)\n\t\tWHERE ts.uid = '" . $mybb->user['uid'] . "' {$visible}\n\t");
$threadcount = $db->fetch_field($query, "threads");
// Fetch subscriptions
$query = $db->query("\n\t\tSELECT s.*, t.*, t.username AS threadusername, u.username, u.username, u.avatar, if({$mybb->user['uid']} > 0 and s.uid = {$mybb->user['uid']}, 1, 0) as subscribed, po.message, f.name as forumname, IF(b.lifted > UNIX_TIMESTAMP() OR b.lifted = 0, 1, 0) as isbanned\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions s\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (s.tid=t.tid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid = t.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "banned b ON (b.uid = t.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "posts po ON (po.pid = t.firstpost)\n\t\tleft join " . TABLE_PREFIX . "forums f on f.fid = t.fid\n\t\tWHERE s.uid='" . $mybb->user['uid'] . "' {$visible}\n\t\tORDER BY t.lastpost DESC\n\t\tLIMIT {$start}, {$limit}\n\t");
while ($subscription = $db->fetch_array($query)) {
$forumpermissions = $fpermissions[$subscription['fid']];
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
// Hmm, you don't have permission to view this thread - unsubscribe!
$del_subscriptions[] = $subscription['tid'];
} else {
if ($subscription['tid']) {
$subscriptions[$subscription['tid']] = $subscription;
}
}
}
if (is_array($del_subscriptions)) {
$tids = implode(',', $del_subscriptions);
if ($tids) {
$db->delete_query("threadsubscriptions", "tid IN ({$tids}) AND uid='{$mybb->user['uid']}'");
}
}
$topic_list = array();
if (is_array($subscriptions)) {
$tids = implode(",", array_keys($subscriptions));
// Build a forum cache.
$query = $db->query("\n\t\t\tSELECT f.fid, fr.dateline AS lastread\n\t\t\tFROM " . TABLE_PREFIX . "forums f\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\t\tWHERE f.active != 0\n\t\t\tORDER BY pid, disporder\n\t\t");
while ($forum = $db->fetch_array($query)) {
if ($mybb->user['uid'] == 0) {
if ($forumsread[$forum['fid']]) {
$forum['lastread'] = $forumsread[$forum['fid']];
}
}
$readforums[$forum['fid']] = $forum['lastread'];
}
// Read threads
if ($mybb->settings['threadreadcut'] > 0) {
$query = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");
while ($readthread = $db->fetch_array($query)) {
$subscriptions[$readthread['tid']]['lastread'] = $readthread['dateline'];
}
}
// Now we can build our subscription list
foreach ($subscriptions as $thread) {
$bgcolor = alt_trow();
$folder = '';
$prefix = '';
// If this thread has a prefix, insert a space between prefix and subject
if ($thread['prefix'] != 0) {
$thread['threadprefix'] .= ' ';
}
// Sanitize
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;
$unreadpost = 0;
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
$forum_read = $readforums[$thread['fid']];
$read_cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($forum_read == 0 || $forum_read < $read_cutoff) {
$forum_read = $read_cutoff;
}
} else {
$forum_read = $forumsread[$thread['fid']];
}
if ($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read) {
$cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
}
if ($thread['lastpost'] > $cutoff) {
if ($thread['lastpost'] > $cutoff) {
if ($thread['lastread']) {
$lastread = $thread['lastread'];
} else {
$lastread = 1;
}
}
}
if (!$lastread) {
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if ($readcookie > $forum_read) {
$lastread = $readcookie;
} else {
$lastread = $forum_read;
}
}
if ($thread['lastpost'] > $lastread && $lastread) {
$unreadpost = 1;
}
$topic_list[] = new xmlrpcval(array('forum_id' => new xmlrpcval($thread['fid'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($thread['forumname']), 'base64'), 'topic_id' => new xmlrpcval($thread['tid'], 'string'), 'topic_title' => new xmlrpcval($thread['subject'], 'base64'), 'topic_author_id' => new xmlrpcval($thread['uid'], 'string'), 'post_author_name' => new xmlrpcval($thread['username'], 'base64'), 'can_subscribe' => new xmlrpcval(true, 'boolean'), 'is_subscribed' => new xmlrpcval((bool) $thread['subscribed'], 'boolean'), 'is_closed' => new xmlrpcval((bool) $thread['closed'], 'boolean'), 'short_content' => new xmlrpcval(process_short_content($thread['message'], $parser), 'base64'), 'icon_url' => new xmlrpcval(absolute_url($thread['avatar']), 'string'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($thread['lastpost']), 'dateTime.iso8601'), 'reply_number' => new xmlrpcval($thread['replies'], 'int'), 'view_number' => new xmlrpcval($thread['views'], 'int'), 'new_post' => new xmlrpcval($unreadpost, 'boolean'), 'can_delete' => new xmlrpcval(is_moderator($thread['fid'], "candeleteposts"), 'boolean'), 'can_close' => new xmlrpcval(is_moderator($thread['fid'], "canopenclosethreads"), 'boolean'), 'can_approve' => new xmlrpcval(is_moderator($thread['fid'], "canopenclosethreads"), 'boolean'), 'can_stick' => new xmlrpcval(is_moderator($thread['fid'], "canmanagethreads"), 'boolean'), 'can_merge' => new xmlrpcval(is_moderator($thread['fid'], "canmanagethreads"), 'boolean'), 'can_merge_post' => new xmlrpcval(is_moderator($thread['fid'], "canmanagethreads"), 'boolean'), 'can_move' => new xmlrpcval(is_moderator($thread['fid'], "canmovetononmodforum"), 'boolean'), 'can_ban' => new xmlrpcval($mybb->usergroup['canmodcp'] == 1, 'boolean'), 'can_rename' => new xmlrpcval(false, 'boolean'), 'is_ban' => new xmlrpcval($thread['isbanned'], 'boolean'), 'is_sticky' => new xmlrpcval($thread['sticky'], 'boolean'), 'is_approved' => new xmlrpcval(!!$thread['visible'], 'boolean'), 'is_deleted' => new xmlrpcval(false, 'boolean')), 'struct');
}
}
$result = new xmlrpcval(array('total_topic_num' => new xmlrpcval($threadcount, 'int'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($result);
}
示例8: latest_threads_get_threadlist
//.........这里部分代码省略.........
$show['fids'] = asb_build_id_list($settings['forum_show_list'], 't.fid');
$show['tids'] = asb_build_id_list($settings['thread_show_list'], 't.tid');
$hide['fids'] = asb_build_id_list($settings['forum_hide_list'], 't.fid');
$hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 't.tid');
$where['show'] = asb_build_SQL_where($show, ' OR ');
$where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT ');
$query_where = $new_threads . $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND ');
$altbg = alt_trow();
$maxtitlelen = 48;
$threadlist = '';
// query for the latest forum discussions
$query = $db->query("\n\t\tSELECT\n\t\t\tt.*,\n\t\t\tu.username, u.avatar, u.usergroup, u.displaygroup\n\t\tFROM {$db->table_prefix}threads t\n\t\tLEFT JOIN {$db->table_prefix}users u ON (u.uid=t.lastposteruid)\n\t\tWHERE\n\t\t\tt.visible='1' AND t.closed NOT LIKE 'moved|%'{$query_where}\n\t\tORDER BY\n\t\t\tt.lastpost DESC\n\t\tLIMIT\n\t\t\t0, " . (int) $settings['max_threads']);
if ($db->num_rows($query) == 0) {
// no content
return false;
}
$thread_cache = array();
while ($thread = $db->fetch_array($query)) {
$thread_cache[$thread['tid']] = $thread;
}
$thread_ids = implode(",", array_keys($thread_cache));
// fetch the read threads.
if ($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0) {
$query = $db->simple_select('threadsread', 'tid,dateline', "uid='{$mybb->user['uid']}' AND tid IN({$thread_ids})");
while ($readthread = $db->fetch_array($query)) {
$thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline'];
}
}
foreach ($thread_cache as $thread) {
$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);
// make sure we can view this thread
if ($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) {
continue;
}
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
// don't link to guest's profiles (they have no profile).
if ($thread['lastposteruid'] == 0) {
$lastposterlink = $thread['lastposter'];
} else {
if ($settings['last_poster_avatar']) {
if (strlen(trim($thread['avatar'])) == 0) {
$thread['avatar'] = "{$theme['imgdir']}/default_avatar.gif";
}
$avatar_width = (int) min($width / 2, max($width / 8, $settings['avatar_width']));
$last_poster_name = <<<EOF
<img src="{$thread['avatar']}" alt="{$thread['last_post']}" title="{$thread['lastposter']}'s profile" style="width: {$avatar_width}px;"/>
EOF;
format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
$lp_template = 'asb_latest_threads_last_poster_avatar';
} else {
$last_poster_name = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
$lp_template = 'asb_latest_threads_last_poster_name';
}
$lastposterlink = build_profile_link($last_poster_name, $thread['lastposteruid']);
}
if (my_strlen($thread['subject']) > $maxtitlelen) {
$thread['subject'] = my_substr($thread['subject'], 0, $maxtitlelen) . "...";
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
eval("\$last_poster = \"" . $templates->get($lp_template) . "\";");
$gotounread = '';
$last_read = 0;
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid']) {
$forum_read = $readforums[$thread['fid']];
$read_cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
if ($forum_read == 0 || $forum_read < $read_cutoff) {
$forum_read = $read_cutoff;
}
} else {
$forum_read = $forumsread[$thread['fid']];
}
if ($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read) {
if ($thread['lastread']) {
$last_read = $thread['lastread'];
} else {
$last_read = $read_cutoff;
}
} else {
$last_read = my_get_array_cookie('threadread', $thread['tid']);
}
if ($forum_read > $last_read) {
$last_read = $forum_read;
}
if ($thread['lastpost'] > $last_read && $last_read) {
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, 'newpost');
eval("\$gotounread = \"" . $templates->get("asb_latest_threads_gotounread") . "\";");
$unreadpost = 1;
}
eval("\$threadlist .= \"" . $templates->get("asb_latest_threads_thread") . "\";");
$altbg = alt_trow();
}
if ($threadlist) {
return $threadlist;
}
// no content
return false;
}