$user->session_begin(false); $auth->acl($user->data); $user->setup(); // End session management // Force all active content BBCodes OFF! $config['switch_bbcb_active_content'] = 0; $cms_page['page_id'] = 'shoutbox'; $cms_page['page_nav'] = (!empty($cms_config_layouts[$cms_page['page_id']]['page_nav']) ? true : false); $cms_page['global_blocks'] = (!empty($cms_config_layouts[$cms_page['page_id']]['global_blocks']) ? true : false); // Force to false... $cms_page['page_nav'] = false; $cms_page['global_blocks'] = false; $cms_auth_level = (isset($cms_config_layouts[$cms_page['page_id']]['view']) ? $cms_config_layouts[$cms_page['page_id']]['view'] : AUTH_ALL); check_page_auth($cms_page['page_id'], $cms_auth_level); // Start auth check switch ($user->data['user_level']) { case ADMIN : case MOD : $is_auth['auth_mod'] = 1; default: $is_auth['auth_read'] = 1; $is_auth['auth_view'] = 1; if ($user->data['user_id'] == ANONYMOUS) { $is_auth['auth_delete'] = 0; $is_auth['auth_post'] = 0; } else
die('Hacking attempt'); } // Usage /* // BBCBMG - BEGIN define('IN_ICYPHOENIX', true); //$bbcbmg_in_acp = true; include(IP_ROOT_PATH . 'includes/bbcb_mg.' . PHP_EXT); $template->assign_var_from_handle('BBCB_MG', 'bbcb_mg'); // BBCBMG - END */ setup_extra_lang(array('lang_bbcb_mg')); // This page is not in layout special... $cms_page_id_tmp = 'pic_upload'; $cms_auth_level_tmp = isset($config['auth_view_pic_upload']) ? $config['auth_view_pic_upload'] : AUTH_ALL; $view_pic_upload = check_page_auth($cms_page_id_tmp, $cms_auth_level_tmp, true); if (defined('BBCB_MG_SMALL')) { $template->set_filenames(array('bbcb_mg' => 'bbcb_mg_small.tpl')); } elseif (defined('BBCB_MG_CUSTOM')) { $template->set_filenames(array('bbcb_mg' => 'bbcb_mg_custom.tpl')); } else { $template->set_filenames(array('bbcb_mg' => 'bbcb_mg.tpl')); } if (!empty($config['enable_postimage_org'])) { $template->assign_var('S_POSTIMAGE_ORG', true); } if (!empty($config['enable_colorpicker'])) { $template->assign_var('S_COLORPICKER', true); } $allowed_langs = array('dutch', 'german', 'italian', 'spanish'); if (in_array($config['default_lang'], $allowed_langs)) {
if ($config['show_thanks_profile'] && empty($config['disable_thanks_topics'])) { $total_thanks_received = user_get_thanks_received($profiledata['user_id']); $template->assign_block_vars('show_thanks_profile', array()); } // Mighty Gorgon - Thanks Received - END // Mighty Gorgon - HTTP AGENTS - BEGIN include IP_ROOT_PATH . 'includes/functions_mg_http.' . PHP_EXT; $user_os = get_user_os($profiledata['user_browser']); $user_browser = get_user_browser($profiledata['user_browser']); // Mighty Gorgon - HTTP AGENTS - END // Mighty Gorgon - Full Album Pack - BEGIN include IP_ROOT_PATH . 'includes/album_mod/album_functions.' . PHP_EXT; include IP_ROOT_PATH . 'includes/album_mod/album_hierarchy_functions.' . PHP_EXT; $cms_page_id_tmp = 'album'; $cms_auth_level_tmp = isset($cms_config_layouts[$cms_page_id_tmp]['view']) ? $cms_config_layouts[$cms_page_id_tmp]['view'] : AUTH_ALL; $show_latest_pics = check_page_auth($cms_page_id_tmp, $cms_auth_level_tmp, true); if ($show_latest_pics) { setup_extra_lang(array('lang_album_main')); $sql = "SELECT * FROM " . ALBUM_CONFIG_TABLE; $result = $db->sql_query($sql, 0, 'album_config_'); while ($row = $db->sql_fetchrow($result)) { $album_config[$row['config_name']] = $row['config_value']; } $db->sql_freeresult($result); $limit_sql = $album_config['img_cols'] * $album_config['img_rows']; $cols_per_page = $album_config['img_cols']; if ($user->data['user_level'] == ADMIN) { $cat_view_level_sql = ''; } elseif (!empty($user->data['session_logged_in'])) { $cat_view_level_sql = " AND c.cat_view_level <= 1 "; } else {
function cms_block_album() { global $db, $cache, $config, $template, $theme, $images, $user, $lang, $table_prefix, $block_id, $cms_config_vars, $cms_config_layouts, $cms_page, $album_config; $cms_page_id_tmp = 'album'; $cms_auth_level_tmp = isset($cms_config_layouts[$cms_page_id_tmp]['view']) ? $cms_config_layouts[$cms_page_id_tmp]['view'] : AUTH_ALL; $process_block = check_page_auth($cms_page_id_tmp, $cms_auth_level_tmp, true); if (!$process_block) { return; } if (!defined('IMG_THUMB')) { define('IMG_THUMB', true); } $template->_tpldata['recent_pics.'] = array(); $template->_tpldata['recent_details.'] = array(); $template->_tpldata['no_pics'] = array(); /* echo($cms_config_vars['md_pics_all'][$block_id] . '<br />'); echo($cms_config_vars[$block_id . '_' . 'md_pics_all']); exit; */ include_once ALBUM_MOD_PATH . 'album_common.' . PHP_EXT; global $album_config; $sql = "SELECT c.*, COUNT(p.pic_id) AS count\n\t\t\t\tFROM " . ALBUM_CAT_TABLE . " AS c\n\t\t\t\t\tLEFT JOIN " . ALBUM_TABLE . " AS p ON c.cat_id = p.pic_cat_id\n\t\t\t\t" . ($cms_config_vars['md_pics_all'][$block_id] == '1' ? '' : 'WHERE cat_user_id = 0') . "\n\t\t\t\tGROUP BY cat_id\n\t\t\t\tORDER BY cat_order ASC"; $result = $db->sql_query($sql); $catrows = array(); while ($row = $db->sql_fetchrow($result)) { $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW if ($album_user_access['view'] == 1) { $catrows[] = $row; } } $db->sql_freeresult($result); if ($cms_config_vars['md_pics_all'][$block_id] == '1') { $allowed_cat = '0'; // For Recent Public Pics below } else { $allowed_cat = ''; } // $catrows now stores all categories which this user can view. Dump them out! for ($i = 0; $i < sizeof($catrows); $i++) { // Build allowed category-list (for recent pics after here) $allowed_cat .= $allowed_cat == '' ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id']; // Get Last Pic of this Category if ($catrows[$i]['count'] == 0) { // // Oh, this category is empty // $last_pic_info = $lang['No_Pics']; $u_last_pic = ''; $last_pic_title = ''; } else { // Check Pic Approval if ($catrows[$i]['cat_approval'] == ALBUM_ADMIN || $catrows[$i]['cat_approval'] == ALBUM_MOD) { $pic_approval_sql = 'AND p.pic_approval = 1'; // Pic Approval ON } else { $pic_approval_sql = ''; // Pic Approval OFF } } } if ($cms_config_vars['md_pics_all'][$block_id] == '1') { $pics_allowed = '0'; } else { $pics_allowed = ''; } $no_pics = false; if ($allowed_cat != $pics_allowed) { $category_id = $cms_config_vars['md_cat_id'][$block_id]; if ($cms_config_vars['md_pics_sort'][$block_id] == '1') { if ($category_id != 0) { $sql = "SELECT p.*, u.user_id, u.username, u.user_active, u.user_color, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments\n\t\t\t\t\t\tFROM " . ALBUM_TABLE . " AS p\n\t\t\t\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON p.pic_user_id = u.user_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_CAT_TABLE . " AS ct ON p.pic_cat_id = ct.cat_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_RATE_TABLE . " AS r ON p.pic_id = r.rate_pic_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_COMMENT_TABLE . " AS c ON p.pic_id = c.comment_pic_id\n\t\t\t\t\t\tWHERE p.pic_cat_id IN ({$allowed_cat}) AND (p.pic_approval = 1 OR ct.cat_approval = 0) AND pic_cat_id IN ({$category_id})\n\t\t\t\t\t\tGROUP BY p.pic_id\n\t\t\t\t\t\tORDER BY RAND()\n\t\t\t\t\t\tLIMIT " . $cms_config_vars['md_pics_number'][$block_id]; } else { $sql = "SELECT p.*, u.user_id, u.username, u.user_active, u.user_color, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments\n\t\t\t\t\t\tFROM " . ALBUM_TABLE . " AS p\n\t\t\t\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON p.pic_user_id = u.user_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_CAT_TABLE . " AS ct ON p.pic_cat_id = ct.cat_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_RATE_TABLE . " AS r ON p.pic_id = r.rate_pic_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_COMMENT_TABLE . " AS c ON p.pic_id = c.comment_pic_id\n\t\t\t\t\t\tWHERE p.pic_cat_id IN ({$allowed_cat}) AND (p.pic_approval = 1 OR ct.cat_approval = 0)\n\t\t\t\t\t\tGROUP BY p.pic_id\n\t\t\t\t\t\tORDER BY RAND()\n\t\t\t\t\t\tLIMIT " . $cms_config_vars['md_pics_number'][$block_id]; } } elseif ($cms_config_vars['md_pics_sort'][$block_id] == '0') { if ($category_id != 0) { $sql = "SELECT p.*, u.user_id, u.username, u.user_active, u.user_color, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments\n\t\t\t\t\t\tFROM " . ALBUM_TABLE . " AS p\n\t\t\t\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON p.pic_user_id = u.user_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_CAT_TABLE . " AS ct ON p.pic_cat_id = ct.cat_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_RATE_TABLE . " AS r ON p.pic_id = r.rate_pic_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_COMMENT_TABLE . " AS c ON p.pic_id = c.comment_pic_id\n\t\t\t\t\t\tWHERE p.pic_cat_id IN ({$allowed_cat}) AND (p.pic_approval = 1 OR ct.cat_approval = 0) AND pic_cat_id IN ({$category_id})\n\t\t\t\t\t\tGROUP BY p.pic_id\n\t\t\t\t\t\tORDER BY pic_time DESC\n\t\t\t\t\t\tLIMIT " . $cms_config_vars['md_pics_number'][$block_id]; } else { $sql = "SELECT p.*, u.user_id, u.username, u.user_active, u.user_color, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments\n\t\t\t\t\t\tFROM " . ALBUM_TABLE . " AS p\n\t\t\t\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON p.pic_user_id = u.user_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_CAT_TABLE . " AS ct ON p.pic_cat_id = ct.cat_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_RATE_TABLE . " AS r ON p.pic_id = r.rate_pic_id\n\t\t\t\t\t\t\tLEFT JOIN " . ALBUM_COMMENT_TABLE . " AS c ON p.pic_id = c.comment_pic_id\n\t\t\t\t\t\tWHERE p.pic_cat_id IN ({$allowed_cat}) AND (p.pic_approval = 1 OR ct.cat_approval = 0)\n\t\t\t\t\t\tGROUP BY p.pic_id\n\t\t\t\t\t\tORDER BY pic_time DESC\n\t\t\t\t\t\tLIMIT " . $cms_config_vars['md_pics_number'][$block_id]; } } $result = $db->sql_query($sql); $recentrow = array(); while ($row = $db->sql_fetchrow($result)) { $recentrow[] = $row; } $db->sql_freeresult($result); $total_pics = sizeof($recentrow); if ($total_pics > 0) { $total_rows = ceil($total_pics / $cms_config_vars['md_pics_rows_number'][$block_id]); $total_cols = ceil($total_pics / $cms_config_vars['md_pics_cols_number'][$block_id]); $image_counter = 0; while ($image_counter < $total_pics) { for ($i = 0; $i < $cms_config_vars['md_pics_rows_number'][$block_id]; $i++) { $template->assign_block_vars('recent_pics', array()); for ($j = 0; $j < $cms_config_vars['md_pics_cols_number'][$block_id]; $j++) { if ($image_counter >= $total_pics) { $template->assign_block_vars('recent_pics.recent_no_detail', array()); } else { if (!$recentrow[$image_counter]['rating']) { $recentrow[$image_counter]['rating'] = $lang['Not_rated']; } else { $recentrow[$image_counter]['rating'] = round($recentrow[$image_counter]['rating'], 2); } if ($recentrow[$image_counter]['user_id'] == ALBUM_GUEST || $recentrow[$image_counter]['username'] == '') { $recent_poster = $recentrow[$image_counter]['pic_username'] == '' ? $lang['Guest'] : $recentrow[$image_counter]['pic_username']; } else { $recent_poster = colorize_username($recentrow[$image_counter]['user_id'], $recentrow[$image_counter]['username'], $recentrow[$image_counter]['user_color'], $recentrow[$image_counter]['user_active']); } $thumbnail_file = append_sid(album_append_uid('album_thumbnail.' . PHP_EXT . '?pic_id=' . $recentrow[$image_counter]['pic_id'])); if ($album_config['thumbnail_cache'] == true && $album_config['quick_thumbs'] == true) { $thumbnail_file = picture_quick_thumb($recentrow[$image_counter]['pic_filename'], $recentrow[$image_counter]['pic_thumbnail'], $thumbnail_file); } $pic_sp_link = append_sid(album_append_uid('album_showpage.' . PHP_EXT . '?pic_id=' . $recentrow[$image_counter]['pic_id'])); $pic_dl_link = append_sid(album_append_uid('album_pic.' . PHP_EXT . '?pic_id=' . $recentrow[$image_counter]['pic_id'])); $template->assign_block_vars('recent_pics.recent_detail', array('U_PIC' => $album_config['fullpic_popup'] ? $pic_dl_link : $pic_sp_link, 'U_PIC_SP' => $pic_sp_link, 'U_PIC_DL' => $pic_dl_link, 'IS_FIRST_PIC' => $image_counter == 0 ? true : false, 'THUMBNAIL' => $thumbnail_file, 'DESC' => $recentrow[$image_counter]['pic_desc'], 'TITLE' => $recentrow[$image_counter]['pic_title'], 'POSTER' => $recent_poster, 'TIME' => create_date_ip($config['default_dateformat'], $recentrow[$image_counter]['pic_time'], $config['board_timezone']), 'VIEW' => $recentrow[$image_counter]['pic_view_count'], 'RATING' => $album_config['rate'] == 1 ? $lang['Rating'] . ': ' . $recentrow[$image_counter]['rating'] . '<br />' : '', 'COMMENTS' => $album_config['comment'] == 1 ? $lang['Comments'] . ': ' . $recentrow[$image_counter]['comments'] . '<br />' : '')); if ($image_counter == 0) { $template->assign_vars(array('HS_GALLERY_ID' => 'hs_gallery_id_' . $recentrow[$image_counter]['pic_id'], 'HS_PIC_ID' => 'hs_pic_id_' . $recentrow[$image_counter]['pic_id'], 'HS_PIC_TITLE' => $recentrow[$image_counter]['pic_title'], 'HS_PIC_FULL' => $pic_dl_link, 'HS_PIC_THUMB' => $thumbnail_file)); } } $image_counter++; } } } } else { // No Pics Found $template->assign_block_vars('no_pics', array()); $no_pics = true; } } else { // No Cats Found $template->assign_block_vars('no_pics', array()); $no_pics = true; } $template->assign_vars(array('S_COL_WIDTH' => 100 / ($cms_config_vars['md_pics_cols_number'][$block_id] == 0 ? 4 : $cms_config_vars['md_pics_cols_number'][$block_id]) . '%', 'S_THUMBNAIL_SIZE' => $album_config['thumbnail_size'], 'TARGET_BLANK' => $album_config['fullpic_popup'] ? 'target="_blank"' : '', 'S_HIGHSLIDE' => !empty($config['thumbnail_highslide']) ? true : false, 'S_HIGHSLIDER' => !empty($cms_config_vars['md_pics_slider'][$block_id]) ? true : false, 'S_JQ_NIVO_SLIDER' => !empty($cms_config_vars['md_pics_slider'][$block_id]) ? true : false, 'S_SLIDER_ID' => 'cms_slider_' . $block_id, 'S_NO_PICS' => !empty($no_pics) ? true : false, 'L_NO_PICS' => $lang['No_Pics'], 'L_PIC_TITLE' => $lang['Pic_Title'], 'L_VIEW' => $lang['View'], 'L_POSTER' => $lang['Poster'], 'L_POSTED' => $lang['Posted'], 'U_ALBUM' => append_sid('album.' . PHP_EXT), 'L_ALBUM' => $lang['Album'])); }
include IP_ROOT_PATH . 'includes/ajax_shoutbox_inc.' . PHP_EXT; } else { if (!isset($cms_page['page_id'])) { $cms_page['page_id'] = 'ajax_chat_archive'; } // Set as tmp value to not overwrite page id if included as a block... // Check before the chat link, so we can then use $cms_page_id_tmp for deciding what template to use $cms_page_id_tmp = 'ajax_chat'; $cms_auth_level_tmp = isset($cms_config_layouts[$cms_page_id_tmp]['view']) ? $cms_config_layouts[$cms_page_id_tmp]['view'] : AUTH_ALL; $ajax_chat_link = check_page_auth($cms_page_id_tmp, $cms_auth_level_tmp, true); // Import settings from other vars if set... or force global blocks to off since this may be run as stand alone $cms_page_id_tmp = 'ajax_chat_archive'; $cms_page['page_nav'] = isset($cms_page['page_nav']) ? $cms_page['page_nav'] : true; $cms_page['global_blocks'] = isset($cms_page['global_blocks']) ? $cms_page['global_blocks'] : false; $cms_auth_level_tmp = isset($cms_config_layouts[$cms_page_id_tmp]['view']) ? $cms_config_layouts[$cms_page_id_tmp]['view'] : AUTH_ALL; check_page_auth($cms_page_id_tmp, $cms_auth_level_tmp); $breadcrumbs['bottom_right_links'] = ($ajax_chat_link == true ? '<a href="' . append_sid('ajax_chat.' . PHP_EXT) . '">' . $lang['Ajax_Chat'] . '</a> ' . MENU_SEP_CHAR . ' ' : '') . '<a href="' . append_sid('ajax_chat.' . PHP_EXT . '?mode=archive') . '">' . $lang['Ajax_Archive'] . '</a>'; $template_to_parse = 'ajax_chat_archive.tpl'; include_once IP_ROOT_PATH . 'includes/functions_ajax_chat.' . PHP_EXT; // Include Post functions and BBCodes include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT; include_once IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT; // Make Pagination and collect some extra data $sql = "SELECT COUNT(s.shout_id) as stored_shouts, MAX(s.shout_id) as total_shouts\n\t\t\t\t\tFROM " . AJAX_SHOUTBOX_TABLE . " s " . (!empty($chat_room_all) ? "" : " WHERE " . $chat_room_sql); $result = $db->sql_query($sql); $num_items = $db->sql_fetchrow($result); $start = request_get_var('start', 0); $start = $start < 0 ? 0 : $start; $template->assign_vars(array('PAGINATION' => generate_pagination('ajax_chat.' . PHP_EXT . '?mode=archive&chat_room=' . $chat_room, $num_items['stored_shouts'], $config['posts_per_page'], $start))); // Get my shouts $sql = "SELECT COUNT(s.shout_id) as count\n\t\t\tFROM " . AJAX_SHOUTBOX_TABLE . " s\n\t\t\tWHERE s.user_id = " . $user->data['user_id'] . (!empty($chat_room_all) ? "" : " AND " . $chat_room_sql);