本文整理匯總了PHP中session::logged_in方法的典型用法代碼示例。如果您正苦於以下問題:PHP session::logged_in方法的具體用法?PHP session::logged_in怎麽用?PHP session::logged_in使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類session
的用法示例。
在下文中一共展示了session::logged_in方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: preinit
public function preinit()
{
parent::preinit();
session_name('sampleApp');
session_start();
if (session::logged_in()) {
session::refresh();
}
}
示例2: start
public static function start($uid)
{
if (!($forum_fid = get_forum_fid())) {
$forum_fid = 0;
}
if (!($user = user_get($uid))) {
$user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => '');
}
unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER'], $user['PEER_NICKNAME']);
$_SESSION = array_merge($_SESSION, $user);
$_SESSION['FID'] = $forum_fid;
$_SESSION['IPADDRESS'] = get_ip_address();
if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) {
$_SESSION = array_merge($_SESSION, $user_prefs);
} else {
$_SESSION = array_merge($_SESSION, user_get_pref_names(array('STYLE')));
}
if ($user_perms = session::get_perm_array($uid, $forum_fid)) {
$_SESSION['PERMS'] = $user_perms;
}
if (!isset($_SESSION['RAND_HASH'])) {
$_SESSION['RAND_HASH'] = md5(uniqid(mt_rand()));
}
if ($uid > 0 && !forum_get_last_visit($uid) && ($gid = perm_get_default_group())) {
perm_add_user_to_group($uid, $gid);
}
}
示例3: light_folder_search_dropdown
function light_folder_search_dropdown($selected_folder)
{
if (!($db = db::get())) {
return false;
}
if (!is_numeric($selected_folder)) {
return false;
}
if (!($table_prefix = get_table_prefix())) {
return false;
}
$available_folders = array();
$access_allowed = USER_PERM_POST_READ;
$sql = "SELECT FID, TITLE FROM `{$table_prefix}FOLDER` ";
$sql .= "ORDER BY FID ";
if (!($result = $db->query($sql))) {
return false;
}
if ($result->num_rows == 0) {
return false;
}
while (($folder_data = $result->fetch_assoc()) !== null) {
if (!session::logged_in()) {
if (session::check_perm(USER_PERM_GUEST_ACCESS, $folder_data['FID'])) {
$available_folders[$folder_data['FID']] = htmlentities_array($folder_data['TITLE']);
}
} else {
if (session::check_perm($access_allowed, $folder_data['FID'])) {
$available_folders[$folder_data['FID']] = htmlentities_array($folder_data['TITLE']);
}
}
}
if (sizeof($available_folders) == 0) {
return false;
}
$available_folders = array(gettext("ALL")) + $available_folders;
return light_form_dropdown_array("fid", $available_folders, $selected_folder);
}
示例4: poll_vote
function poll_vote($tid, $vote_array)
{
if (($uid = session::get_value('UID')) === false) {
return false;
}
if (!is_numeric($tid)) {
return false;
}
if (!is_array($vote_array)) {
return false;
}
if (!($db = db::get())) {
return false;
}
if (!($table_prefix = get_table_prefix())) {
return false;
}
$poll_data = poll_get($tid);
$poll_results = poll_get_votes($tid);
$current_datetime = date(MYSQL_DATETIME, time());
if (!poll_get_user_votes($tid) || $poll_data['CHANGEVOTE'] == POLL_VOTE_MULTI || !session::logged_in() && ($poll_data['ALLOWGUESTS'] == POLL_GUEST_ALLOWED && forum_get_setting('poll_allow_guests', 'Y'))) {
foreach ($vote_array as $question_id => $option_data) {
if (!is_numeric($question_id) || !isset($poll_results[$question_id])) {
continue;
}
if (is_array($option_data) && sizeof($option_data) > 0) {
foreach ($option_data as $option_id => $option_value) {
if (!is_numeric($option_id) || $option_value != 'Y') {
continue;
}
if (!isset($poll_results[$question_id]['OPTIONS_ARRAY'][$option_id])) {
continue;
}
$sql = "INSERT INTO `{$table_prefix}USER_POLL_VOTES` (TID, UID, QUESTION_ID, OPTION_ID, VOTED) ";
$sql .= "VALUES ('{$tid}', '{$uid}', '{$question_id}', '{$option_id}', CAST('{$current_datetime}' AS DATETIME))";
if (!$db->query($sql)) {
return false;
}
}
} else {
if (is_numeric($option_data)) {
if (!isset($poll_results[$question_id]['OPTIONS_ARRAY'][$option_data])) {
continue;
}
$sql = "INSERT INTO `{$table_prefix}USER_POLL_VOTES` (TID, UID, QUESTION_ID, OPTION_ID, VOTED) ";
$sql .= "VALUES ('{$tid}', '{$uid}', '{$question_id}', '{$option_data}', CAST('{$current_datetime}' AS DATETIME))";
if (!$db->query($sql)) {
return false;
}
}
}
}
}
return true;
}
示例5: attachments_make_link
function attachments_make_link($attachment, $show_thumbs = true, $limit_filename = false, $local_path = false, $img_tag = true)
{
if (!is_array($attachment)) {
return false;
}
if (!is_bool($show_thumbs)) {
$show_thumbs = true;
}
if (!is_bool($limit_filename)) {
$limit_filename = false;
}
if (!is_bool($local_path)) {
$local_path = false;
}
if (!is_bool($img_tag)) {
$img_tag = true;
}
if (!($attachment_dir = attachments_check_dir())) {
return false;
}
if (!isset($attachment['hash'])) {
return false;
}
if (!isset($attachment['filename'])) {
return false;
}
if (!isset($attachment['downloads'])) {
return false;
}
if (!is_md5($attachment['hash'])) {
return false;
}
$thumbnail_max_size = 100;
$webtag = get_webtag();
forum_check_webtag_available($webtag);
if (isset($_SESSION['SHOW_THUMBS']) && is_numeric($_SESSION['SHOW_THUMBS'])) {
$user_show_thumbs = $_SESSION['SHOW_THUMBS'];
} else {
$user_show_thumbs = 100;
}
if ($show_thumbs && forum_get_setting('attachment_thumbnails', 'Y') && ($user_show_thumbs > 0 || !session::logged_in())) {
$thumbnail_size = array(1 => 50, 2 => 100, 3 => 150);
$thumbnail_max_size = isset($thumbnail_size[$user_show_thumbs]) ? $thumbnail_size[$user_show_thumbs] : 100;
} else {
$show_thumbs = false;
}
if ($local_path) {
$attachment_href = "attachments/{$attachment['filename']}";
} else {
$attachment_href = "get_attachment.php?webtag={$webtag}&hash={$attachment['hash']}";
$attachment_href .= "&filename={$attachment['filename']}";
}
if ($img_tag) {
$title_array = array();
if (mb_strlen($attachment['filename']) > 16 && $limit_filename) {
$title_array[] = sprintf(gettext("Filename: %s"), $attachment['filename']);
$attachment['filename'] = format_file_name($attachment['filename']);
}
if (isset($attachment['filesize']) && is_numeric($attachment['filesize']) && $attachment['filesize'] > 0) {
$title_array[] = sprintf(gettext("Size: %s"), format_file_size($attachment['filesize']));
}
if ($attachment['downloads'] == 1) {
$title_array[] = gettext("Downloaded: 1 time");
} else {
$title_array[] = sprintf(gettext("Downloaded: %d times"), $attachment['downloads']);
}
if (isset($attachment['width'], $attachment['height'])) {
$title_array[] = sprintf(gettext("Dimensions %dx%dpx"), $attachment['width'], $attachment['height']);
}
$title = implode(", ", $title_array);
if ($show_thumbs && isset($attachment['thumbnail']) && $attachment['thumbnail'] == 'Y') {
$thumbnail_width = 150;
$thumbnail_height = 150;
while ($thumbnail_width > $thumbnail_max_size) {
$thumbnail_width--;
$thumbnail_height--;
}
$attachment_link = "<a href=\"{$attachment_href}\" target=\"_blank\"><span class=\"attachment_thumb\" ";
$attachment_link .= "style=\"background-image: url('{$attachment_href}&thumb=1'); ";
$attachment_link .= "width: {$thumbnail_width}px; height: {$thumbnail_height}px\" ";
$attachment_link .= "title=\"{$title}\"></span></a>";
} else {
$attachment_link = html_style_image('attach', gettext("Attachment"));
$attachment_link .= "<a href=\"{$attachment_href}\" title=\"{$title}\" ";
$attachment_link .= "target=\"_blank\">{$attachment['filename']}</a>";
}
return $attachment_link;
}
return $attachment_href;
}
示例6: messages_forum_stats
function messages_forum_stats($tid, $pid)
{
$webtag = get_webtag();
forum_check_webtag_available($webtag);
if (forum_get_setting('show_stats', 'Y')) {
echo "<br />\n";
echo "<div align=\"center\" class=\"messages_forum_stats\">\n";
echo " <form action=\"user_stats.php\" method=\"get\" target=\"_self\">\n";
echo " ", form_input_hidden('webtag', $webtag), "\n";
echo " ", form_input_hidden('msg', "{$tid}.{$pid}"), "\n";
echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"96%\">\n";
echo " <tr>\n";
echo " <td align=\"center\">\n";
echo " <table class=\"box\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"posthead\">\n";
echo " <table class=\"posthead\" width=\"100%\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td>\n";
echo " <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"subhead\">", gettext("Forum Stats"), "</td>\n";
echo " <td align=\"right\" class=\"subhead\">\n";
if (!session::logged_in()) {
echo " ";
} else {
if (isset($_SESSION['SHOW_STATS']) && $_SESSION['SHOW_STATS'] == 'Y') {
echo " ", form_submit_image('hide', 'forum_stats_toggle', 'hide', null, 'button_image toggle_button'), "\n";
} else {
echo " ", form_submit_image('show', 'forum_stats_toggle', 'show', null, 'button_image toggle_button'), "\n";
}
}
echo " </td>\n";
echo " </tr>";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
if (!session::logged_in() || isset($_SESSION['SHOW_STATS']) && $_SESSION['SHOW_STATS'] == 'Y') {
echo " <div id=\"forum_stats\" class=\"forum_stats_toggle\">\n";
} else {
echo " <div id=\"forum_stats\" class=\"forum_stats_toggle\" style=\"display: none\">\n";
}
echo " <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
echo " <tr>\n";
echo " <td rowspan=\"19\" width=\"35\"> </td>\n";
echo " <td> </td>\n";
echo " <td rowspan=\"19\" width=\"35\"> </td>\n";
echo " </tr>\n";
for ($i = 0; $i < 18; $i++) {
echo " <tr>\n";
echo " <td> </td>\n";
echo " </tr>\n";
}
echo " </table>\n";
echo " </div>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " </form>\n";
echo "</div>\n";
}
}
示例7: thread_get
function thread_get($tid, $inc_deleted = false, $inc_empty = false)
{
if (!($db = db::get())) {
return false;
}
$fidlist = folder_get_available();
if (!($table_prefix = get_table_prefix())) {
return false;
}
if (($uid = session::get_value('UID')) === false) {
return false;
}
if (!is_numeric($tid)) {
return false;
}
$unread_cutoff_timestamp = threads_get_unread_cutoff();
$sql = "SELECT THREAD.TID, THREAD.FID, THREAD.DELETED, THREAD.LENGTH, ";
$sql .= "TRIM(CONCAT_WS(' ', COALESCE(FOLDER.PREFIX, ''), THREAD.TITLE)) AS TITLE, ";
$sql .= "THREAD.POLL_FLAG, THREAD.STICKY, THREAD.UNREAD_PID, ";
$sql .= "THREAD_STATS.VIEWCOUNT, USER_THREAD.LAST_READ, USER_THREAD.INTEREST, ";
$sql .= "THREAD.BY_UID, UNIX_TIMESTAMP(THREAD.CLOSED) AS CLOSED, ";
$sql .= "UNIX_TIMESTAMP(THREAD.ADMIN_LOCK) AS ADMIN_LOCK, ";
$sql .= "UNIX_TIMESTAMP(THREAD.CREATED) AS CREATED, THREAD.ADMIN_LOCK, ";
$sql .= "UNIX_TIMESTAMP(THREAD.STICKY_UNTIL) AS STICKY_UNTIL, ";
$sql .= "UNIX_TIMESTAMP(THREAD.MODIFIED) AS MODIFIED, USER.UID, USER.LOGON, ";
$sql .= "USER.NICKNAME, USER_PEER.PEER_NICKNAME, USER_PEER.RELATIONSHIP, ";
$sql .= "FOLDER.TITLE AS FOLDER_TITLE FROM `{$table_prefix}THREAD` THREAD ";
$sql .= "LEFT JOIN `{$table_prefix}THREAD_STATS` THREAD_STATS ";
$sql .= "ON (THREAD_STATS.TID = THREAD.TID) ";
$sql .= "LEFT JOIN `{$table_prefix}USER_THREAD` USER_THREAD ";
$sql .= "ON (THREAD.TID = USER_THREAD.TID AND USER_THREAD.UID = '{$uid}') ";
$sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ";
$sql .= "ON (USER_PEER.PEER_UID = THREAD.BY_UID AND USER_PEER.UID = '{$uid}') ";
$sql .= "LEFT JOIN USER USER ON (USER.UID = THREAD.BY_UID) ";
$sql .= "LEFT JOIN `{$table_prefix}FOLDER` FOLDER ON (FOLDER.FID = THREAD.FID) ";
$sql .= "WHERE THREAD.TID = '{$tid}' AND THREAD.FID IN ({$fidlist}) ";
if ($inc_deleted === false) {
$sql .= "AND THREAD.DELETED = 'N' ";
}
if ($inc_empty === false) {
$sql .= "AND THREAD.LENGTH > 0 ";
}
if (!($result = $db->query($sql))) {
return false;
}
if ($result->num_rows == 0) {
return false;
}
$thread_data = $result->fetch_assoc();
if (!isset($thread_data['INTEREST'])) {
$thread_data['INTEREST'] = 0;
}
if (!session::logged_in()) {
$thread_data['LAST_READ'] = 0;
} else {
if (!isset($thread_data['LAST_READ']) || !is_numeric($thread_data['LAST_READ'])) {
$thread_data['LAST_READ'] = 0;
if (isset($thread_data['MODIFIED']) && $unread_cutoff_timestamp !== false && $thread_data['MODIFIED'] < $unread_cutoff_timestamp) {
$thread_data['LAST_READ'] = $thread_data['LENGTH'];
} else {
if (isset($thread_data['UNREAD_PID']) && is_numeric($thread_data['UNREAD_PID'])) {
$thread_data['LAST_READ'] = $thread_data['UNREAD_PID'];
}
}
}
}
if (!isset($thread_data['STICKY_UNTIL'])) {
$thread_data['STICKY_UNTIL'] = 0;
}
if (!isset($thread_data['ADMIN_LOCK'])) {
$thread_data['ADMIN_LOCK'] = 0;
}
if (!isset($thread_data['CLOSED'])) {
$thread_data['CLOSED'] = 0;
}
if (!isset($thread_data['DELETED'])) {
$thread_data['DELETED'] = 'N';
}
if (isset($thread_data['LOGON']) && isset($thread_data['PEER_NICKNAME'])) {
if (!is_null($thread_data['PEER_NICKNAME']) && strlen($thread_data['PEER_NICKNAME']) > 0) {
$thread_data['NICKNAME'] = $thread_data['PEER_NICKNAME'];
}
}
if (!isset($thread_data['LOGON'])) {
$thread_data['LOGON'] = gettext("Unknown user");
}
if (!isset($thread_data['NICKNAME'])) {
$thread_data['NICKNAME'] = "";
}
thread_has_attachments($thread_data);
return $thread_data;
}
示例8: logSQL
if ($_GET['login'] == "guest" && $enable_guest_mode != 1) {
$_SESSION['guest'] = 0;
}
if ($enable_user_login != 1) {
$login = $_POST['login'];
$password = $_POST['password'];
logSQL("POSSIBLE HACK ATTEMPT. Person was from IP: '" . getIP() . "'. and used Username: '{$login}' Password: '{$password}'.");
$_SESSION['error'] = 1;
} else {
session::login($_POST['login'], $_POST['password']);
}
header('Location: index.php');
exit;
}
// Verify user is logged in
if (session::logged_in() != TRUE) {
$body = new Template("templates/login.tmpl.php");
$error = isset($_SESSION['error']) ? 1 : 0;
$body->set('enable_guest_mode', $enable_guest_mode);
$body->set('enable_user_login', $enable_user_login);
$body->set('error', $error);
$body->set('login', $login);
$body->set('password', $password);
$tmpl->set('body', $body);
echo $tmpl->fetch('templates/index.tmpl.php');
unset($_SESSION['error']);
exit;
}
// Get IP address
function getIP()
{
示例9: adsense_output_html
function adsense_output_html()
{
static $adsense_displayed = false;
$webtag = get_webtag();
forum_check_webtag_available($webtag);
if ($adsense_displayed === false) {
if (adsense_publisher_id()) {
$adsense_display_users = adsense_display_users();
$ad_type = 'medium';
$ad_width = 468;
$ad_height = 60;
adsense_get_banner_type($ad_type, $ad_width, $ad_height);
echo "<div class=\"google_adsense_container\" style=\"width: 100%; text-align: center\">\n";
echo " <div style=\"width: {$ad_width}px; margin: auto\">\n";
echo " <script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>\n";
if (!session::logged_in() && $adsense_display_users == ADSENSE_DISPLAY_GUESTS) {
echo " <div class=\"google_adsense_register_note\"><a href=\"index.php?webtag={$webtag}&final_uri=register.php%3Fwebtag%3D{$webtag}\" target=\"", html_get_top_frame_name(), "\">", gettext("Register to remove these adverts."), "</a></div>\n";
}
echo " </div>\n";
echo "</div>\n";
$adsense_displayed = true;
}
}
}
示例10: refresh
public static function refresh($uid)
{
$ip_address = get_ip_address();
$http_referer = session::get_http_referer();
if (!($forum_fid = get_forum_fid())) {
$forum_fid = 0;
}
if (!($user = user_get($uid))) {
$user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => '');
}
unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER']);
$_SESSION = array_merge($_SESSION, $user);
$_SESSION['FID'] = $forum_fid;
$_SESSION['IPADDRESS'] = get_ip_address();
if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) {
$_SESSION = array_merge($_SESSION, $user_prefs);
}
if ($user_perms = session::get_perm_array($uid, $forum_fid)) {
$_SESSION['PERMS'] = $user_perms;
}
if (!isset($_SESSION['REFERER'])) {
$_SESSION['REFERER'] = session::get_http_referer();
}
if (!isset($_SESSION['RAND_HASH'])) {
$_SESSION['RAND_HASH'] = md5(uniqid(mt_rand()));
}
if (isset($user_prefs['STYLE'])) {
html_set_cookie("forum_style", $user_prefs['STYLE'], time() + YEAR_IN_SECONDS);
}
}
示例11: pm_get_unread_count
function pm_get_unread_count()
{
if (!($db = db::get())) {
return false;
}
if (!isset($_SESSION['UID']) || !is_numeric($_SESSION['UID'])) {
return false;
}
// Guests don't do PMs.
if (!session::logged_in()) {
return false;
}
$pm_unread = PM_UNREAD;
// Check to see if the user has any new PMs
$sql = "SELECT COUNT(MID) FROM PM_TYPE WHERE (TYPE & {$pm_unread}) ";
$sql .= "AND UID = '{$_SESSION['UID']}' ";
if (!($result = $db->query($sql))) {
return false;
}
list($pm_unread_count) = $result->fetch_row();
return $pm_unread_count;
}
示例12: attachments_make_link
function attachments_make_link($attachment, $show_thumbs = true, $limit_filename = false, $local_path = false, $img_tag = true)
{
if (!is_array($attachment)) {
return false;
}
if (!is_bool($show_thumbs)) {
$show_thumbs = true;
}
if (!is_bool($limit_filename)) {
$limit_filename = false;
}
if (!is_bool($local_path)) {
$local_path = false;
}
if (!is_bool($img_tag)) {
$img_tag = true;
}
if (!($attachment_dir = forum_get_setting('attachment_dir'))) {
return false;
}
if (!isset($attachment['aid'])) {
return false;
}
if (!isset($attachment['hash'])) {
return false;
}
if (!isset($attachment['filename'])) {
return false;
}
if (!isset($attachment['downloads'])) {
return false;
}
if (!is_md5($attachment['aid'])) {
return false;
}
if (!is_md5($attachment['hash'])) {
return false;
}
$webtag = get_webtag();
if (forum_get_setting('attachment_thumbnails', 'Y') && (($user_show_thumbs = session::get_value('SHOW_THUMBS')) > 0 || !session::logged_in())) {
$thumbnail_size = array(1 => 50, 2 => 100, 3 => 150);
$thumbnail_max_size = isset($thumbnail_size[$user_show_thumbs]) ? $thumbnail_size[$user_show_thumbs] : 100;
} else {
$thumbnail_max_size = 100;
$show_thumbs = false;
}
if ($local_path) {
$attachment_href = "attachments/{$attachment['filename']}";
} else {
$attachment_href = "get_attachment.php?webtag={$webtag}&hash={$attachment['hash']}";
$attachment_href .= "&filename={$attachment['filename']}";
}
if ($img_tag === true) {
$title_array = array();
if (mb_strlen($attachment['filename']) > 16 && $limit_filename) {
$title_array[] = gettext("Filename") . ": {$attachment['filename']}";
$attachment['filename'] = mb_substr($attachment['filename'], 0, 16);
$attachment['filename'] .= "…";
}
if (isset($attachment['filesize']) && is_numeric($attachment['filesize'])) {
$title_array[] = gettext("Size") . ": " . format_file_size($attachment['filesize']);
}
if ($attachment['downloads'] == 1) {
$title_array[] = gettext("Downloaded: 1 time");
} else {
$title_array[] = sprintf(gettext("Downloaded: %d times"), $attachment['downloads']);
}
if (@file_exists("{$attachment_dir}/{$attachment['hash']}.thumb") && $show_thumbs) {
if (@($image_info = getimagesize("{$attachment_dir}/{$attachment['hash']}"))) {
$title_array[] = gettext("Dimensions") . ": {$image_info[0]}x{$image_info[1]}px";
$thumbnail_width = $image_info[0];
$thumbnail_height = $image_info[1];
while ($thumbnail_width > $thumbnail_max_size || $thumbnail_height > $thumbnail_max_size) {
$thumbnail_width--;
$thumbnail_height = floor($thumbnail_width * ($image_info[1] / $image_info[0]));
}
$title = implode(", ", $title_array);
$attachment_link = "<span class=\"attachment_thumb\"><a href=\"{$attachment_href}\" title=\"{$title}\" ";
$attachment_link .= "target=\"_blank\"><img src=\"{$attachment_href}&thumb=1\"";
$attachment_link .= "border=\"0\" width=\"{$thumbnail_width}\" height=\"{$thumbnail_height}\"";
$attachment_link .= "alt=\"{$title}\" title=\"{$title}\" /></a></span>";
return $attachment_link;
}
}
$title = implode(", ", $title_array);
$attachment_link = "<img src=\"";
$attachment_link .= html_style_image('attach.png');
$attachment_link .= "\" width=\"14\" height=\"14\" border=\"0\" ";
$attachment_link .= "alt=\"" . gettext("Attachment") . "\" ";
$attachment_link .= "title=\"" . gettext("Attachment") . "\" />";
$attachment_link .= "<a href=\"{$attachment_href}\" title=\"{$title}\" ";
$attachment_link .= "target=\"_blank\">{$attachment['filename']}</a>\n";
return $attachment_link;
}
return $attachment_href;
}
示例13: pm_get_unread_count
function pm_get_unread_count()
{
if (!($db = db::get())) {
return false;
}
if (($uid = session::get_value('UID')) === false) {
return false;
}
// Guests don't do PMs.
if (!session::logged_in()) {
return false;
}
$pm_unread = PM_UNREAD;
// Check to see if the user has any new PMs
$sql = "SELECT COUNT(MID) FROM PM WHERE (TYPE & {$pm_unread} > 0) ";
$sql .= "AND TO_UID = '{$uid}'";
if (!($result = $db->query($sql))) {
return false;
}
list($pm_unread_count) = $result->fetch_row();
return $pm_unread_count;
}
示例14:
USA
======================================================================*/
// Bootstrap
require_once 'boot.php';
// Required includes
require_once BH_INCLUDE_PATH . 'attachments.inc.php';
require_once BH_INCLUDE_PATH . 'cache.inc.php';
require_once BH_INCLUDE_PATH . 'constants.inc.php';
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'forum.inc.php';
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
// End Required includes
// Check we're logged in correctly, or have access to attachments.
if (!session::logged_in() && !forum_get_setting('attachment_allow_guests', 'Y')) {
html_guest_error();
}
// If the attachments directory is undefined we can't go any further
if (!($attachment_dir = attachments_check_dir())) {
html_draw_error(gettext("Attachments have been disabled by the forum owner."));
}
// Check we have a valid attachment hash.
if (!isset($_GET['hash']) || !is_md5($_GET['hash'])) {
html_draw_error(gettext('Missing or invalid attachment hash'));
}
// Get the hash from the URL query.
$hash = $_GET['hash'];
// Get the array of allowed attachment mime-types
$attachment_mime_types = attachments_get_mime_types();
// Get the attachment details.
示例15: messages_forum_stats
function messages_forum_stats($tid, $pid)
{
$webtag = get_webtag();
if (forum_get_setting('show_stats', 'Y')) {
echo "<br />\n";
echo "<div align=\"center\">\n";
echo " <form action=\"user_stats.php\" method=\"get\" target=\"_self\">\n";
echo " ", form_input_hidden('webtag', $webtag), "\n";
echo " ", form_input_hidden('msg', "{$tid}.{$pid}"), "\n";
echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"96%\">\n";
echo " <tr>\n";
echo " <td align=\"center\">\n";
echo " <table class=\"box\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"posthead\">\n";
echo " <table class=\"posthead\" width=\"100%\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td>\n";
echo " <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo " <tr>\n";
echo " <td align=\"left\" class=\"subhead\">", gettext("Forum Stats"), "</td>\n";
echo " <td align=\"right\" class=\"subhead\">\n";
if (!session::logged_in()) {
echo " ";
} else {
if (session::get_value("SHOW_STATS") == "Y") {
echo " ", form_submit_image('hide.png', 'forum_stats_toggle', 'hide', '', 'button_image toggle_button'), "\n";
} else {
echo " ", form_submit_image('show.png', 'forum_stats_toggle', 'show', '', 'button_image toggle_button'), "\n";
}
}
echo " </td>\n";
echo " </tr>";
echo " </table>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
if (!session::logged_in() || session::get_value("SHOW_STATS") == "Y") {
echo " <div id=\"forum_stats\" class=\"forum_stats_toggle\">\n";
} else {
echo " <div id=\"forum_stats\" class=\"forum_stats_toggle\" style=\"display: none\">\n";
}
echo " <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\" id=\"active_user_counts\"></td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\" class=\"activeusers\" id=\"active_user_list\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\" id=\"thread_stats\"> <br /> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\" id=\"post_stats\"> <br /> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\" id=\"user_stats\"> <br /> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " <td align=\"left\"> </td>\n";
echo " <td align=\"left\" width=\"35\"> </td>\n";
echo " </tr>\n";
echo " <tr>\n";
//.........這裏部分代碼省略.........