/** * Put top code for the page **/ function PageCode($admintmpl = 0) { global $dir; global $site; global $_page; global $_page_comp; global $logged; global $langHTMLCharset; global $tmpl; global $ADMIN; global $tmi_letters; global $dbh_letters; global $max_thumb_height; global $max_thumb_width; global $_page_cont; $ni = $_page['name_index']; global $oTemplConfig; $oTemplMenu = new BxTemplMenu($oTemplConfig); $free_mode = getParam("free_mode") == "on" ? 1 : 0; // reading templates if (!$admintmpl) { $fn = "{$dir['root']}templates/tmpl_{$tmpl}/page_{$ni}.html"; if (!file_exists($fn)) { $fn = "{$dir['root']}templates/tmpl_{$tmpl}/default.html"; } } else { $fn = "{$dir['root']}admin/tmpl_admin.html"; } $templ = file_get_contents($fn); // process includes (multi-level) do { $templ1 = $templ; $templ = preg_replace_callback("/__include (.*)__/", "TmplInclude", $templ1); $templ = preg_replace_callback("/__includebase (.*)__/", "TmplIncludeBase", $templ); } while ($templ1 != $templ); //insert to your template page key: __t: lang_key__ and you will get translated string $templ = preg_replace_callback("/__t: (_.+)__/", create_function('$matches', 'return _t($matches[1]);'), $templ); PageStaticComponents(); // lang block if ((int) getParam('lang_enable')) { ob_start(); lang_select_txt(); $_page_cont[0]['switch_lang_block'] = ob_get_clean(); } else { $_page_cont[0]['switch_lang_block'] = ''; } // charset $_page_cont[0]['page_charset'] = $langHTMLCharset; //change templates if ('on' == getParam("enable_template")) { $_page_cont[0]['switch_skin_block'] = templates_select_txt(); } else { $_page_cont[0]['switch_skin_block'] = ''; } //Path to css if (strlen($_page['css_name']) > 0) { $filename = $dir['root'] . $site['css_dir'] . $_page['css_name']; if (file_exists($filename) && is_file($filename)) { $_page_cont[0]['styles'] = '<link href="' . $site['css_dir'] . $_page['css_name'] . '" rel="stylesheet" type="text/css" />'; } else { $_page_cont[0]['styles'] = ''; } } else { $_page_cont[0]['styles'] = ''; } //Path to js if (strlen($_page['js_name']) > 0) { $filename = $dir['root'] . 'inc/js/' . $_page['js_name']; if (file_exists($filename) && is_file($filename)) { $langDelete = _t('_delete'); $langLoading = _t('_loading ...'); $langDeleteMessage = _t('_poll successfully deleted'); $langMakeIt = _t('_make it'); $lang_you_should_specify_member = _t('_You should specify at least one member'); if ($site['js_init']) { $_page_cont[0]['java_script'] = $site['js_init']; } $_page_cont[0]['java_script'] .= <<<EOJ <script type="text/javascript" language="javascript"> \tvar site_url = '{$site['url']}'; \tvar lang_delete = '{$langDelete}'; \tvar lang_loading = '{$langLoading}'; \tvar lang_delete_message = '{$langDeleteMessage}'; \tvar lang_make_it = '{$langMakeIt}'; \tvar lang_you_should_specify_member = '{$lang_you_should_specify_member}'; \t \tvar iQSearchWindowWidth = {$oTemplConfig->iQSearchWindowWidth}; \tvar iQSearchWindowHeight = {$oTemplConfig->iQSearchWindowHeight}; </script> <script src="{$site['url']}inc/js/{$_page['js_name']}" type="text/javascript" language="javascript"></script> EOJ; } else { $_page_cont[0]['java_script'] = ''; } } else { $_page_cont[0]['java_script'] = ''; } $_page_cont[0]['css_dir'] = $site['css_dir']; $_page_cont[0]['plugins'] = $site['plugins']; $_page_cont[0]['thumb_width'] = $max_thumb_width; $_page_cont[0]['thumb_height'] = $max_thumb_height; $_page_cont[0]['site_url'] = $site['url']; $_page_cont[0]['images'] = $site['images']; $_page_cont[0]['icons'] = $site['icons']; $_page_cont[0]['zodiac'] = $site['zodiac']; $_page_cont[0]['bottom_text'] = _t("_bottom_text", date("Y")); $_page_cont[0]['copyright'] = _t("_copyright", date("Y")) . getVersionComment(); // please do not delete version for debug possibilities $_page_cont[0]['powered'] = getParam('enable_boonex_footers') ? _t("_powered_by_Dolphin") : ''; $_page_cont[0]['main_logo'] = getMainLogo(); //place meta data on site pages $_page_cont[0]['meta_keywords'] = process_line_output(getParam("MetaKeyWords")); $_page_cont[0]['meta_description'] = process_line_output(getParam("MetaDescription")); if (strlen($_page['extra_js'])) { $_page_cont[0]['extra_js'] = $_page['extra_js']; } else { $_page_cont[0]['extra_js'] = ''; } if (strlen($_page['extra_css'])) { $_page_cont[0]['extra_css'] = $_page['extra_css']; } else { $_page_cont[0]['extra_css'] = ''; } // top menu items $_page_cont[0]['top_menu'] = $oTemplMenu->getTopMenu(); $_page_cont[0]['hidden_menu'] = getAllMenus(); $_page_cont[0]['custom_menu'] = $oTemplMenu->getCustomMenu(); $_page_cont[0]['TOP_Home'] = '<a class="menu_item_link" href="' . $site['url'] . 'index.php">' . _t("_Home") . '</a>'; $_page_cont[0]['BMI_Home'] = '<a class="bottommenu" href="' . $site['url'] . 'index.php">' . _t("_Home") . '</a>'; $_page_cont[0]['TOP_About'] = '<a class="menu_item_link" href="' . $site['url'] . 'about_us.php">' . _t("_About Us") . '</a>'; $_page_cont[0]['BMI_About'] = '<a class="bottommenu" href="' . $site['url'] . 'about_us.php">' . _t("_About Us") . '</a>'; $_page_cont[0]['TOP_Privacy'] = '<a class="menu_item_link" href="' . $site['url'] . 'privacy.php">' . _t("_Privacy") . '</a>'; $_page_cont[0]['BMI_Privacy'] = '<a class="bottommenu" href="' . $site['url'] . 'privacy.php">' . _t("_Privacy") . '</a>'; $_page_cont[0]['TOP_Termsofuse'] = '<a class="menu_item_link" href="' . $site['url'] . 'terms_of_use.php">' . _t("_Terms_of_use") . '</a>'; $_page_cont[0]['BMI_Termsofuse'] = '<a class="bottommenu" href="' . $site['url'] . 'terms_of_use.php">' . _t("_Terms_of_use") . '</a>'; $_page_cont[0]['TOP_Services'] = '<a class="menu_item_link" href="' . $site['url'] . 'services.php">' . _t("_Services") . '</a>'; $_page_cont[0]['BMI_Services'] = '<a class="bottommenu" href="' . $site['url'] . 'services.php">' . _t("_Services") . '</a>'; $_page_cont[0]['TOP_FAQ'] = '<a class="menu_item_link" href="' . $site['url'] . 'faq.php">' . _t("_FAQ") . '</a>'; $_page_cont[0]['BMI_FAQ'] = '<a class="bottommenu" href="' . $site['url'] . 'faq.php">' . _t("_FAQ") . '</a>'; $_page_cont[0]['TOP_Articles'] = '<a class="menu_item_link" href="' . $site['url'] . 'articles.php">' . _t("_Articles") . '</a>'; $_page_cont[0]['BMI_Articles'] = '<a class="bottommenu" href="' . $site['url'] . 'articles.php">' . _t("_Articles") . '</a>'; $_page_cont[0]['TOP_Stories'] = '<a class="menu_item_link" href="' . $site['url'] . 'stories.php">' . _t("_Stories2") . '</a>'; $_page_cont[0]['BMI_Stories'] = '<a class="bottommenu" href="' . $site['url'] . 'stories.php">' . _t("_Stories2") . '</a>'; $_page_cont[0]['TOP_Links'] = '<a class="menu_item_link" href="' . $site['url'] . 'links.php">' . _t("_Links") . '</a>'; $_page_cont[0]['BMI_Links'] = '<a class="bottommenu" href="' . $site['url'] . 'links.php">' . _t("_Links") . '</a>'; $_page_cont[0]['TOP_News'] = '<a class="menu_item_link" href="' . $site['url'] . 'news.php">' . _t("_News") . '</a>'; $_page_cont[0]['BMI_News'] = '<a class="bottommenu" href="' . $site['url'] . 'news.php">' . _t("_News") . '</a>'; $_page_cont[0]['TOP_Aff'] = getParam("enable_aff") == 'on' ? '<a class="menu_item_link" href="' . $site['url'] . 'affiliates.php">' . _t("_Affiliates") . '</a>' : ''; $_page_cont[0]['BMI_Aff'] = getParam("enable_aff") == 'on' ? '<a class="bottommenu" href="' . $site['url'] . 'affiliates.php">' . _t("_Affiliates") . '</a>' : ''; $_page_cont[0]['TOP_Invitefriend'] = '<a class="menu_item_link" href="javascript:void(0);" onclick="return launchTellFriend();">' . _t("_Invite a friend") . '</a>'; $_page_cont[0]['BMI_Invitefriend'] = '<a class="bottommenu" href="javascript:void(0);" onclick="return launchTellFriend();">' . _t("_Invite a friend") . '</a>'; $_page_cont[0]['TOP_Contacts'] = '<a class="menu_item_link" href="' . $site['url'] . 'contact.php">' . _t("_Contacts") . '</a>'; $_page_cont[0]['BMI_Contacts'] = '<a class="bottommenu" href="' . $site['url'] . 'contact.php">' . _t("_Contacts") . '</a>'; $_page_cont[0]['TOP_Browse'] = '<a class="menu_item_link" href="' . $site['url'] . 'browse.php">' . _t("_Browse Profiles") . '</a>'; $_page_cont[0]['BMI_Browse'] = '<a class="bottommenu" href="' . $site['url'] . 'browse.php">' . _t("_Browse Profiles") . '</a>'; $_page_cont[0]['TOP_Feedback'] = '<a class="menu_item_link" href="' . $site['url'] . 'story.php">' . _t("_Add story") . '</a>'; $_page_cont[0]['BMI_Feedback'] = '<a class="bottommenu" href="' . $site['url'] . 'story.php">' . _t("_Add story") . '</a>'; $_page_cont[0]['TOP_ContactUs'] = '<a class="menu_item_link" href="' . $site['url'] . 'contact.php">' . _t("_contact_us") . '</a>'; $_page_cont[0]['BMI_ContactUs'] = '<a class="bottommenu" href="' . $site['url'] . 'contact.php">' . _t("_contact_us") . '</a>'; $_page_cont[0]['TOP_Bookmark'] = '<a class="menu_item_link" href="javascript:void(0);" onclick="addBookmark();">' . _t("_Bookmark") . '</a>'; $_page_cont[0]['BMI_Bookmark'] = '<a class="bottommenu" href="javascript:void(0);" onclick="addBookmark();">' . _t("_Bookmark") . '</a>'; $_page_cont[0]['hello_member'] = HelloMemberSection(); // member/visitor menu if ($logged['admin']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedAdminMenu(); } elseif ($logged['aff']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedAffMenu(); } elseif ($logged['moderator']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedModeratorMenu(); } elseif ($logged['member']) { $_page_cont[0]['menu_right'] = $oTemplMenu->loggedMemberMenu(); } else { $_page_cont[0]['menu_right'] = $oTemplMenu->visitorMenu(); } /*if ( !strlen($_page_cont[$ni]['actions_menu']) ) $_page_cont[0]['actions_menu'] = $oTemplMenu -> actionsMenu();*/ if (!strlen($_page_cont[$ni]['add_to_header'])) { $_page_cont[0]['add_to_header'] = ''; } $check_res = checkAction((int) $_COOKIE['memberID'], ACTION_ID_USE_IM); $enable_im = getParam("enable_im"); if ($enable_im && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED && !$ADMIN) { $_page_cont[0]['IM_title'] = _t("_IM title"); $_page_cont[0]['IM'] = RetIM(); } else { $_page_cont[0]['IM_title'] = ""; $_page_cont[0]['IM'] = ""; } $enable_shoutBox = 'on' == getParam("enable_shoutBox") ? 1 : 0; if ($enable_shoutBox) { $_page_cont[0]['shout_box'] = loadShoutbox(); } else { $_page_cont[0]['shout_box'] = ''; } $_page_cont[0]['top_page_head'] = getTopPageHead(); // page header $_page_cont[0]['page_header'] = $_page['header']; $_page_cont[0]['page_header_text'] = $_page['header_text']; // banner rotation/shifting system if (strstr($templ, "__banner_top__")) { $_page_cont[0]['banner_top'] = banner_put_nv(1); } if (strstr($templ, "__banner_left__")) { $_page_cont[0]['banner_left'] = banner_put_nv(2); } if (strstr($templ, "__banner_right__")) { $_page_cont[0]['banner_right'] = banner_put_nv(3); } if (strstr($templ, "__banner_bottom__")) { $_page_cont[0]['banner_bottom'] = banner_put_nv(4); } //end of banner rotation/shifting system //--- Ray IM Integration ---// global $sRayHomeDir; $_page_cont[0]['ray_invite_js'] = "\r\n\t\t<script type=\"text/javascript\" language=\"javascript\">\r\n\t\t\tvar sRayUrl = '" . $site['url'] . $sRayHomeDir . "';\r\n\t\t</script>\r\n\t\t<script src=\"" . $site['url'] . "ray/modules/global/js/integration.js\" type=\"text/javascript\" language=\"javascript\"></script>"; $_page_cont[0]['ray_invite_swf'] = ""; $iId = (int) $_COOKIE['memberID']; $sPassword = getPassword($iId); $bEnableRay = getParam('enable_ray') == 'on'; $check_res = checkAction($iId, ACTION_ID_USE_RAY_IM); if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $_page_cont[0]['ray_invite_swf'] = getApplicationContent("im", "invite", array('id' => $iId, 'password' => $sPassword), true); } //--- Ray IM Integration ---// foreach ($_page_cont[0] as $key => $value) { $templ = str_replace("__{$key}__", $value, $templ); } if (is_array($_page_cont[$ni])) { foreach ($_page_cont[$ni] as $key => $value) { $templ = str_replace("__{$key}__", $value, $templ); } } header('Content-type: text/html; charset=utf-8'); echo $templ; }