コード例 #1
0
ファイル: details.php プロジェクト: abhinay100/fourimages_app
     if (!empty($comment_user_homepage)) {
         $comment_user_homepage_button = "<a href=\"" . $comment_user_homepage . "\" target=\"_blank\"><img src=\"" . get_gallery_image("homepage.gif") . "\" border=\"0\" alt=\"" . $comment_user_homepage . "\" /></a>";
     }
     $comment_user_icq = isset($comment_row[$i][$user_table_fields['user_icq']]) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
     if (!empty($comment_user_icq)) {
         $comment_user_icq_button = "<a href=\"http://www.icq.com/people/about_me.php?uin=" . $comment_user_icq . "\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=" . $comment_user_icq . "&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"" . $comment_user_icq . "\" /></a>";
     }
     if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1)) {
         $comment_user_email = format_text($comment_row[$i][$user_table_fields['user_email']]);
         $comment_user_email_save = format_text(str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]));
         if (!empty($url_mailform)) {
             $comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
         } else {
             $comment_user_mailform_link = $site_sess->url(ROOT_PATH . "member.php?action=mailform&amp;" . URL_USER_ID . "=" . $comment_user_id);
         }
         $comment_user_email_button = "<a href=\"" . $comment_user_mailform_link . "\"><img src=\"" . get_gallery_image("email.gif") . "\" border=\"0\" alt=\"" . $comment_user_email_save . "\" /></a>";
     }
     if (!isset($comment_row[$i][$user_table_fields['user_level']]) || isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER) {
         $comment_user_info = $lang['userlevel_user'];
     } elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
         $comment_user_info = $lang['userlevel_admin'];
     }
     $comment_user_info .= "<br />";
     $comment_user_info .= isset($comment_row[$i][$user_table_fields['user_joindate']]) ? "<br />" . $lang['join_date'] . " " . format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
     $comment_user_info .= isset($comment_row[$i][$user_table_fields['user_comments']]) ? "<br />" . $lang['comments'] . " " . $comment_row[$i][$user_table_fields['user_comments']] : "";
 }
 $comment_user_ip = $user_info['user_level'] == ADMIN ? $comment_row[$i]['comment_ip'] : "";
 $admin_links = "";
 if ($user_info['user_level'] == ADMIN) {
     $admin_links .= "<a href=\"" . $site_sess->url(ROOT_PATH . "admin/index.php?goto=" . urlencode("comments.php?action=editcomment&amp;comment_id=" . $comment_row[$i]['comment_id'])) . "\" target=\"_blank\">" . $lang['edit'] . "</a>&nbsp;";
     $admin_links .= "<a href=\"" . $site_sess->url(ROOT_PATH . "admin/index.php?goto=" . urlencode("comments.php?action=removecomment&amp;comment_id=" . $comment_row[$i]['comment_id'])) . "\" target=\"_blank\">" . $lang['delete'] . "</a>";
コード例 #2
0
ファイル: functions.php プロジェクト: 4images/4images
function show_image($image_row, $mode = "", $show_link = 1, $detailed_view = 0)
{
    global $self_url, $site_template, $site_sess, $user_info, $config, $cat_cache, $lang, $additional_image_fields, $user_table_fields, $url_show_profile;
    $is_new = $image_row['image_date'] >= time() - 60 * 60 * 24 * $config['new_cutoff'] ? 1 : 0;
    $description = !empty($image_row['image_description']) ? format_text($image_row['image_description'], 1, 0, 1) : REPLACE_EMPTY;
    if (!empty($image_row['image_keywords'])) {
        $split_keywords = explode(",", $image_row['image_keywords']);
        $keywords = "";
        foreach ($split_keywords as $key => $val) {
            $url_val = $val;
            if (preg_match('/[^a-z0-9]+/i', $url_val)) {
                $url_val = '"' . $url_val . '"';
            }
            $keywords .= ($keywords != "" ? ", " : "") . "<a href=\"" . $site_sess->url(ROOT_PATH . "search.php?search_keywords=" . urlencode($url_val)) . "\">" . format_text($val, 2) . "</a>";
        }
    } else {
        $keywords = REPLACE_EMPTY;
    }
    if (!check_permission("auth_readcomment", $image_row['cat_id'])) {
        $image_row['image_allow_comments'] = 0;
    }
    $num_comments = $image_row['image_allow_comments'] == 1 ? $image_row['image_comments'] : "";
    if ($user_info['user_level'] != GUEST) {
        $lightbox_url = $self_url;
        $lightbox_url .= !empty($mode) ? (strpos($lightbox_url, '?') !== false ? "&amp;" : "?") . "mode=" . $mode : "";
        $lightbox_url .= strpos($lightbox_url, '?') !== false ? "&amp;" : "?";
        if (check_lightbox($image_row['image_id'])) {
            $lightbox_url .= "action=removefromlightbox&amp;id=" . $image_row['image_id'];
            $lightbox_button = "<a href=\"" . $site_sess->url($lightbox_url) . "\"><img src=\"" . get_gallery_image("lightbox_yes.gif") . "\" border=\"0\" alt=\"\" /></a>";
        } else {
            $lightbox_url .= "action=addtolightbox&amp;id=" . $image_row['image_id'];
            $lightbox_button = "<a href=\"" . $site_sess->url($lightbox_url) . "\"><img src=\"" . get_gallery_image("lightbox_no.gif") . "\" border=\"0\" alt=\"\" /></a>";
        }
    } else {
        $lightbox_button = "<img src=\"" . get_gallery_image("lightbox_off.gif") . "\" border=\"0\" alt=\"\" />";
    }
    if (!check_permission("auth_download", $image_row['cat_id'])) {
        $download_button = "<img src=\"" . get_gallery_image("download_off.gif") . "\" border=\"0\" alt=\"\" />";
        $download_zip_button = function_exists("gzcompress") && function_exists("crc32") ? "<img src=\"" . get_gallery_image("download_zip_off.gif") . "\" border=\"0\" alt=\"\" />" : "";
        $allow_download = 0;
        clear_download_token($image_row['image_id']);
    } else {
        $target = !empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']) && !is_local_file($image_row['image_download_url']) ? "target=\"_blank\"" : "";
        $download_button = "<a href=\"" . $site_sess->url(ROOT_PATH . "download.php?" . URL_IMAGE_ID . "=" . $image_row['image_id']) . "\"" . $target . "><img src=\"" . get_gallery_image("download.gif") . "\" border=\"0\" alt=\"\" /></a>";
        $download_zip_button = $target == "" && function_exists("gzcompress") && function_exists("crc32") ? "<a href=\"" . $site_sess->url(ROOT_PATH . "download.php?action=zip&amp;" . URL_IMAGE_ID . "=" . $image_row['image_id']) . "\"" . $target . "><img src=\"" . get_gallery_image("download_zip.gif") . "\" border=\"0\" alt=\"\" /></a>" : "";
        $allow_download = 1;
        set_download_token($image_row['image_id']);
    }
    if (!check_permission("auth_sendpostcard", $image_row['cat_id'])) {
        $postcard_button = "<img src=\"" . get_gallery_image("postcard_off.gif") . "\" border=\"0\" alt=\"\" />";
    } else {
        $postcard_button = "<a href=\"" . $site_sess->url(ROOT_PATH . "postcards.php?" . URL_IMAGE_ID . "=" . $image_row['image_id'] . (!empty($mode) ? "&amp;mode=" . $mode : "")) . "\"><img src=\"" . get_gallery_image("postcard.gif") . "\" border=\"0\" alt=\"\" /></a>";
    }
    if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
        $show_link = 0;
    }
    $file_size = "n/a";
    if (!is_remote($image_row['image_media_file'])) {
        if ($file_size = @filesize(MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_media_file'])) {
            $file_size = format_file_size($file_size);
        }
    } elseif ($detailed_view) {
        $file_size = get_remote_file_size($image_row['image_media_file']);
    }
    if (isset($image_row[$user_table_fields['user_name']]) && $image_row['user_id'] != GUEST) {
        $user_name = format_text($image_row[$user_table_fields['user_name']], 2);
        $user_profile_link = !empty($url_show_profile) ? str_replace("{user_id}", $image_row['user_id'], $url_show_profile) : ROOT_PATH . "member.php?action=showprofile&amp;" . URL_USER_ID . "=" . $image_row['user_id'];
        $user_name_link = "<a href=\"" . $site_sess->url($user_profile_link) . "\">" . $user_name . "</a>";
    } else {
        $user_name = format_text($lang['userlevel_guest'], 2);
        $user_name_link = $user_name;
    }
    $site_template->register_vars(array("image_id" => $image_row['image_id'], "user_id" => $image_row['user_id'], "user_name" => $user_name, "user_name_link" => $user_name_link, "image_name" => format_text($image_row['image_name'], 2), "image_description" => $description, "image_keywords" => $keywords, "image_date" => format_date($config['date_format'] . " " . $config['time_format'], $image_row['image_date']), "image_is_new" => $is_new, "lang_new" => $lang['new'], "image_active" => $image_row['image_active'], "cat_id" => $image_row['cat_id'], "cat_name" => format_text($image_row['cat_name'], 2), "cat_url" => $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . $image_row['cat_id']), "image_downloads" => $image_row['image_downloads'], "image_votes" => $image_row['image_votes'], "image_rating" => $image_row['image_rating'], "image_hits" => $image_row['image_hits'], "allow_comments" => $image_row['image_allow_comments'], "lang_comments" => $lang['comments'], "image_comments" => $num_comments, "lightbox_button" => $lightbox_button, "postcard_button" => $postcard_button, "download_button" => $download_button, "download_zip_button" => $download_zip_button, "image_download_url" => $image_row['image_download_url'], "allow_download" => $allow_download, "url_download" => $site_sess->url(ROOT_PATH . "download.php?" . URL_IMAGE_ID . "=" . $image_row['image_id']), "image_file_size" => $file_size, "image_url" => $show_link ? $site_sess->url(ROOT_PATH . "details.php?" . URL_IMAGE_ID . "=" . $image_row['image_id'] . (!empty($mode) ? "&amp;mode=" . $mode : "")) : "", "thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link), "thumbnail_openwindow" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, 1), "image_file_name" => $image_row['image_media_file'], "thumbnail_file_name" => $image_row['image_thumb_file']));
    if (!empty($additional_image_fields)) {
        $additional_field_array = array();
        foreach ($additional_image_fields as $key => $val) {
            $additional_field_array[$key] = !empty($image_row[$key]) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
            $additional_field_array['lang_' . $key] = $val[0];
        }
        if (!empty($additional_field_array)) {
            $site_template->register_vars($additional_field_array);
        }
    }
    $rate_form = "";
    if (check_permission("auth_vote", $image_row['cat_id'])) {
        $site_template->register_vars("rate", $lang['rate']);
        $rate_form = $site_template->parse_template("rate_form");
    }
    $site_template->register_vars("rate_form", $rate_form);
    $site_template->register_vars(array("image" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view)));
    return true;
}
コード例 #3
0
            }
            $thumbnails .= "</tr>\n";
        }
    }
    $thumbnails .= "</table>\n";
}
// end else
$lightbox_lastaction = format_date($config['date_format'] . " " . $config['time_format'], $user_info['lightbox_lastaction']);
if (empty($user_info['lightbox_lastaction'])) {
    $lightbox_lastaction = "n/a";
}
$site_template->register_vars(array("thumbnails" => $thumbnails, "lightbox_lastaction" => $lightbox_lastaction));
unset($thumbnails);
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"" . $site_sess->url(ROOT_PATH . "index.php") . "\" class=\"clickstream\">" . $lang['home'] . "</a>" . $config['category_separator'] . $lang['lightbox'] . "</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$download_button = "";
if (function_exists("gzcompress") && function_exists("crc32")) {
    if ($download_allowed && !empty($user_info['lightbox_image_ids'])) {
        $download_button = "<a href=\"" . $site_sess->url(ROOT_PATH . "download.php?action=lightbox") . "\"><img src=\"" . get_gallery_image("download_zip.gif") . "\" border=\"0\" alt=\"\" /></a>";
    } else {
        $download_button = "<img src=\"" . get_gallery_image("download_zip_off.gif") . "\" border=\"0\" alt=\"\" />";
    }
}
$site_template->register_vars(array("msg" => $msg, "clickstream" => $clickstream, "lang_lightbox" => $lang['lightbox'], "lang_delete_lightbox" => $lang['delete_lightbox'], "url_delete_lightbox" => $site_sess->url(ROOT_PATH . "lightbox.php?action=clearlightbox"), "lang_delete_lightbox_confirm" => $lang['delete_lightbox_confirm'], "lang_lightbox_lastaction" => $lang['lighbox_lastaction'], "download_button" => $download_button));
$site_template->print_template($site_template->parse_template($main_template));
include ROOT_PATH . 'includes/page_footer.php';
コード例 #4
0
     $site_sess->mode = 'get';
 }
 ob_start();
 //-----------------------------------------------------
 //--- SEO variables -----------------------------------
 //-----------------------------------------------------
 $site_template->register_vars(array('prepend_head_title' => $cat_cache[$cat_id]['cat_name'] . " - "));
 //-----------------------------------------------------
 //--- Show Categories ---------------------------------
 //-----------------------------------------------------
 if (!check_permission("auth_upload", $cat_id)) {
     $upload_url = "";
     $upload_button = "<img src=\"" . get_gallery_image("upload_off.gif") . "\" border=\"0\" alt=\"\" />";
 } else {
     $upload_url = $site_sess->url(ROOT_PATH . "member.php?action=uploadform&amp;" . URL_CAT_ID . "=" . $cat_id);
     $upload_button = "<a href=\"" . $upload_url . "\"><img src=\"" . get_gallery_image("upload.gif") . "\" border=\"0\" alt=\"\" /></a>";
 }
 $random_cat_image = defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 ? "" : get_random_image($cat_id);
 $site_template->register_vars(array("categories" => get_categories($cat_id), "cat_name" => format_text($cat_cache[$cat_id]['cat_name'], 2), "cat_description" => format_text($cat_cache[$cat_id]['cat_description'], 1, 0, 1), "cat_hits" => $cat_cache[$cat_id]['cat_hits'], "upload_url" => $upload_url, "upload_button" => $upload_button, "random_cat_image" => $random_cat_image));
 unset($random_cat_image);
 //-----------------------------------------------------
 //--- Show Images -------------------------------------
 //-----------------------------------------------------
 $site_template->register_vars(array("has_rss" => true, "rss_title" => "RSS Feed: " . format_text($cat_cache[$cat_id]['cat_name'], 2) . " (" . str_replace(':', '', $lang['new_images']) . ")", "rss_url" => $script_url . "/rss.php?action=images&amp;" . URL_CAT_ID . "=" . $cat_id));
 $num_rows_all = isset($cat_cache[$cat_id]['num_images']) ? $cat_cache[$cat_id]['num_images'] : 0;
 $link_arg = $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . $cat_id);
 include ROOT_PATH . 'includes/paging.php';
 $getpaging = new Paging($page, $perpage, $num_rows_all, $link_arg);
 $offset = $getpaging->get_offset();
 $site_template->register_vars(array("paging" => $getpaging->get_paging(), "paging_stats" => $getpaging->get_paging_stats()));
 $imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);