本文整理汇总了PHP中loadTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP loadTemplate函数的具体用法?PHP loadTemplate怎么用?PHP loadTemplate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadTemplate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Facebooka
public function Facebooka()
{
global $fb_object, $fb_hook_object, $modSettings, $sourcedir, $context;
require_once $sourcedir . '/ManageServer.php';
loadTemplate('FacebookAdmin');
allowedTo('admin_forum');
$fb_object = new SAFacebookadmin();
$context['html_headers'] .= '
<script type="text/javascript">
function fbLogin() {
FB.login(function(response) {
if (response.authResponse) {
alert(\'' . $fb_object->txt['fb_grantperm1'] . '\');
window.location = \'https://www.facebook.com/dialog/oauth?client_id=' . $modSettings['fb_app_id'] . '&redirect_uri=' . urlencode($fb_hook_object->scripturl . '') . '&scope=email,publish_actions\';
}
else {
alert(\'' . $fb_object->txt['fb_grantperm'] . '\');
}
}, {scope: \'email,publish_actions\'});
}
</script>';
$context['page_title'] = $fb_hook_object->txt['fb_main1'];
$context[$context['admin_menu_name']]['tab_data']['title'] = $fb_hook_object->txt['fb_main1'];
$context[$context['admin_menu_name']]['tab_data']['description'] = $fb_hook_object->txt['fb_main1'];
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($fb_object->subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'facebook';
call_user_func(array('SAFacebookadmin', $fb_object->subActions[$_REQUEST['sa']]));
}
示例2: CopyTopic
function CopyTopic()
{
global $txt, $board, $topic, $scripturl, $sourcedir, $modSettings, $context;
global $db_prefix, $ID_MEMBER, $boards, $language, $user_info, $func;
if (empty($topic)) {
fatal_lang_error(1);
}
// Permission check!
isAllowedTo('copy');
loadTemplate('CopyTopic');
// Get a list of boards this moderator can move to.
$request = db_query("\n\t\tSELECT b.ID_BOARD, b.name, b.childLevel, c.name AS catName\n\t\tFROM {$db_prefix}boards AS b\n\t\t\tLEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)\n\t\tWHERE {$user_info['query_see_board']}", __FILE__, __LINE__);
$context['boards'] = array();
while ($row = mysql_fetch_assoc($request)) {
$context['boards'][] = array('id' => $row['ID_BOARD'], 'name' => $row['name'], 'category' => $row['catName'], 'child_level' => $row['childLevel'], 'selected' => !empty($_SESSION['copy_to_topic']) && $_SESSION['copy_to_topic'] == $row['ID_BOARD']);
}
mysql_free_result($request);
if (empty($context['boards'])) {
fatal_lang_error('copytopic_noboards', false);
}
$context['page_title'] = $txt['copytopic'];
$context['back_to_topic'] = isset($_REQUEST['goback']);
// Register this form and get a sequence number in $context.
checkSubmitOnce('register');
}
示例3: showVerification
public function showVerification($isNew, $force_refresh = true)
{
loadTemplate('reCaptcha');
loadTemplate('VerificationControls');
loadJavascriptFile('https://www.google.com/recaptcha/api.js');
return true;
}
示例4: gmm_main
/**
* gmm_main()
*
* Traffic cop, checks permissions
* calls the template which in turn calls this to request the xml file or js file to template inclusion
*
* @return
*/
function gmm_main()
{
global $context, $txt, $smcFunc;
// Are we allowed to view the map?
isAllowedTo('googleMap_view');
loadLanguage('GoogleMap');
// Build the XML data?
if (isset($_REQUEST['sa']) && $_REQUEST['sa'] === '.xml') {
return gmm_build_XML();
}
// create the pins (urls) for use
gmm_buildpins();
// Build the JS data?
if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == '.js') {
return gmm_build_JS();
}
// load up our template and style sheet
loadTemplate('GoogleMap', 'GoogleMap');
// Lets find number of members that have placed their map pin for the template
$request = $smcFunc['db_query']('', '
SELECT COUNT(*) as TOTAL
FROM {db_prefix}members
WHERE latitude <> false AND longitude <> false', array());
$totalSet = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// show the map
$context['total_pins'] = $totalSet[0];
$context['sub_template'] = 'map';
$context['page_title'] = $txt['googleMap'];
}
示例5: load_theme
public static function load_theme()
{
global $context, $modSettings, $txt, $settings, $user_info;
if (($themes = cache_get_data('TS_themes_list', 3600)) === null) {
loadLanguage('ManageThemes');
require_once SUBSDIR . '/Themes.subs.php';
$themes = availableThemes($user_info['theme'], $user_info['id']);
cache_put_data('TS_themes_list', $themes, 3600);
}
foreach ($themes[0] as $theme_id => $theme) {
$name = $theme['name'];
$selected = !empty($user_info['theme']) && $user_info['theme'] == $theme_id;
$context['ThemeSelector'][$theme_id] = array('name' => $name, 'selected' => $selected, 'variants' => array());
if (isset($theme['variants'])) {
foreach ($theme['variants'] as $key => $variant) {
$context['ThemeSelector'][$theme_id]['variants'][$key] = array('name' => $variant['label'], 'selected' => $context['theme_variant'] == '_' . $key);
}
}
}
if (!isset($context['theme_header_callbacks'])) {
$context['theme_header_callbacks'] = array();
}
$context['theme_header_callbacks'][] = 'themeselector';
loadTemplate('ThemeSelector');
loadJavascriptFile('ThemeSelector.js');
loadCSSFile('ThemeSelector.css');
}
示例6: Blog
function Blog()
{
global $boarddir, $context, $mbname, $smcFunc, $modSettings, $scripturl, $settings, $txt;
// Some version stuff
$context['blog_version'] = array('version' => '2.0', 'build' => '1', 'revision' => '$Revision: 1 $', 'date' => '$Date: 2010-01-30 18:54:44 +0 $');
// Is the blog disabled?
if (empty($modSettings['blog_enable'])) {
// Sorry bud, nothing we can do about this...
fatal_lang_error('blog_error_disabled');
}
// Link tree....
$context['linktree'][] = array('url' => $scripturl . '?action=blog', 'name' => $txt['blog']);
// We need some SSI functions.
require_once $boarddir . '/SSI.php';
// Load our template.
loadTemplate('Blog');
// Use the blog layer
$context['template_layers'][] = 'blog';
// Add our stylesheet.
$context['html_headers'] .= '
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/blog.css" />';
// A default page title.
$context['page_title'] = $context['forum_name'] . ' ' . $txt['blog'];
// Some actions we can do.
$actions = array('index' => 'BlogIndex', 'view_blog' => 'BlogView', 'view_post' => 'BlogViewPost');
// Get the current action.
$action = isset($_GET['sa']) ? $_GET['sa'] : 'index';
// Check if the action exist, otherwise go to the index.
if (isset($actions[$action])) {
$actions[$action]();
} else {
BlogIndex();
}
}
示例7: PrintTopic
function PrintTopic()
{
global $db_prefix, $topic, $txt, $scripturl, $context;
global $board_info;
if (empty($topic)) {
fatal_lang_error(472, false);
}
// Get the topic starter information.
$request = db_query("\n\t\tSELECT m.posterTime, IFNULL(mem.realName, m.posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE m.ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG\n\t\tLIMIT 1", __FILE__, __LINE__);
if (mysql_num_rows($request) == 0) {
fatal_lang_error('smf232');
}
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
// Lets "output" all that info.
loadTemplate('Printpage');
$context['template_layers'] = array('print');
$context['board_name'] = $board_info['name'];
$context['category_name'] = $board_info['cat']['name'];
$context['poster_name'] = $row['posterName'];
$context['post_time'] = timeformat($row['posterTime'], false);
// Split the topics up so we can print them.
$request = db_query("\n\t\tSELECT subject, posterTime, body, IFNULL(mem.realName, posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG", __FILE__, __LINE__);
$context['posts'] = array();
while ($row = mysql_fetch_assoc($request)) {
// Censor the subject and message.
censorText($row['subject']);
censorText($row['body']);
$context['posts'][] = array('subject' => $row['subject'], 'member' => $row['posterName'], 'time' => timeformat($row['posterTime'], false), 'timestamp' => forum_time(true, $row['posterTime']), 'body' => parse_bbc($row['body'], 'print'));
if (!isset($context['topic_subject'])) {
$context['topic_subject'] = $row['subject'];
}
}
mysql_free_result($request);
}
示例8: indexAction
function indexAction($smarty)
{
$smarty->assign('pageTitle', 'Головна сторінка сайту');
//loadTemplate($smarty,'index');
loadTemplate($smarty, 'header');
//loadTemplate($smarty,'footer');
}
示例9: Memberlist
function Memberlist()
{
global $scripturl, $txt, $modSettings, $context, $settings;
// Make sure they can view the memberlist.
isAllowedTo('view_mlist');
loadTemplate('Memberlist');
$context['listing_by'] = !empty($_GET['sa']) ? $_GET['sa'] : 'all';
// $subActions array format:
// 'subaction' => array('label', 'function', 'is_selected')
$subActions = array('all' => array(&$txt[303], 'MLAll', $context['listing_by'] == 'all'), 'search' => array(&$txt['mlist_search'], 'MLSearch', $context['listing_by'] == 'search'));
// Set up the sort links.
$context['sort_links'] = array();
foreach ($subActions as $act => $text) {
$context['sort_links'][] = array('label' => $text[0], 'action' => $act, 'selected' => $text[2]);
}
$context['num_members'] = $modSettings['totalMembers'];
// Set up the columns...
$context['columns'] = array('isOnline' => array('label' => $txt['online8'], 'width' => '20'), 'realName' => array('label' => $txt[35]), 'emailAddress' => array('label' => $txt[307], 'width' => '25'), 'websiteUrl' => array('label' => $txt[96], 'width' => '25'), 'ICQ' => array('label' => $txt[513], 'width' => '25'), 'AIM' => array('label' => $txt[603], 'width' => '25'), 'YIM' => array('label' => $txt[604], 'width' => '25'), 'MSN' => array('label' => $txt['MSN'], 'width' => '25'), 'ID_GROUP' => array('label' => $txt[87]), 'registered' => array('label' => $txt[233]), 'posts' => array('label' => $txt[21], 'width' => '115', 'colspan' => '2'));
$context['linktree'][] = array('url' => $scripturl . '?action=mlist', 'name' => &$txt[332]);
$context['can_send_pm'] = allowedTo('pm_send');
// Jump to the sub action.
if (isset($subActions[$context['listing_by']])) {
$subActions[$context['listing_by']][1]();
} else {
$subActions['all'][1]();
}
}
示例10: akismet_load_theme
function akismet_load_theme()
{
global $context, $topic;
// Is this a topic being displayed?
if (empty($_REQUEST['action']) && !empty($board) && !empty($topic)) {
// Looking through the topic table can be slow, so try using the cache first.
if (($spam = cache_get_data('akismet-spam-topic-' . $topic, 3600)) === NULL) {
$request = $smcFunc['db_query']('', '
SELECT id_topic
FROM {db_prefix}topics
WHERE id_topic = {int:id_topic}', array('id_topic' => $topic));
// So did it find anything?
if ($smcFunc['db_num_rows']($request)) {
list($spam) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Save save save.
cache_put_data('akismet-spam-topic-' . $topic, $spam, 120);
}
}
if (!empty($span)) {
// So we now know this is a spam topic. Show a warning.
loadLanguage('Akismet');
loadTemplate('Akismet');
$context['template_layers'][] = 'akismet_warn_topic';
}
}
}
示例11: sportal_pages
function sportal_pages()
{
global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info;
loadTemplate('PortalPages');
$page_id = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0;
if (is_numeric($page_id)) {
$page_id = (int) $page_id;
} else {
$page_id = $smcFunc['htmlspecialchars']($page_id, ENT_QUOTES);
}
$context['SPortal']['page'] = sportal_get_pages($page_id, true, true);
if (empty($context['SPortal']['page']['id'])) {
fatal_lang_error('error_sp_page_not_found', false);
}
$context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], true);
if (empty($_SESSION['last_viewed_page']) || $_SESSION['last_viewed_page'] != $context['SPortal']['page']['id']) {
$smcFunc['db_query']('', '
UPDATE {db_prefix}sp_pages
SET views = views + 1
WHERE id_page = {int:current_page}', array('current_page' => $context['SPortal']['page']['id']));
$_SESSION['last_viewed_page'] = $context['SPortal']['page']['id'];
}
$context['linktree'][] = array('url' => $scripturl . '?page=' . $page_id, 'name' => $context['SPortal']['page']['title']);
$context['page_title'] = $context['SPortal']['page']['title'];
$context['sub_template'] = 'view_page';
}
示例12: ManageSmileys
function ManageSmileys()
{
global $context, $txt, $scripturl, $modSettings;
isAllowedTo('manage_smileys');
adminIndex('manage_smileys');
loadLanguage('ManageSmileys');
loadTemplate('ManageSmileys');
$subActions = array('addsmiley' => 'AddSmiley', 'editicon' => 'EditMessageIcons', 'editicons' => 'EditMessageIcons', 'editsets' => 'EditSmileySets', 'editsmileys' => 'EditSmileys', 'import' => 'EditSmileySets', 'modifyset' => 'EditSmileySets', 'modifysmiley' => 'EditSmileys', 'setorder' => 'EditSmileyOrder', 'settings' => 'EditSmileySettings', 'install' => 'InstallSmileySet');
// Default the sub-action to 'edit smiley settings'.
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'settings';
$context['page_title'] =& $txt['smileys_manage'];
$context['sub_action'] = $_REQUEST['sa'];
$context['sub_template'] =& $context['sub_action'];
// Load up all the tabs...
$context['admin_tabs'] = array('title' => &$txt['smileys_manage'], 'help' => 'smileys', 'description' => $txt['smiley_settings_explain'], 'tabs' => array('editsets' => array('title' => $txt['smiley_sets'], 'description' => $txt['smiley_editsets_explain'], 'href' => $scripturl . '?action=smileys;sa=editsets'), 'addsmiley' => array('title' => $txt['smileys_add'], 'description' => $txt['smiley_addsmiley_explain'], 'href' => $scripturl . '?action=smileys;sa=addsmiley'), 'editsmileys' => array('title' => $txt['smileys_edit'], 'description' => $txt['smiley_editsmileys_explain'], 'href' => $scripturl . '?action=smileys;sa=editsmileys'), 'setorder' => array('title' => $txt['smileys_set_order'], 'description' => $txt['smiley_setorder_explain'], 'href' => $scripturl . '?action=smileys;sa=setorder'), 'editicons' => array('title' => $txt['icons_edit_message_icons'], 'description' => $txt['icons_edit_icons_explain'], 'href' => $scripturl . '?action=smileys;sa=editicons'), 'settings' => array('title' => $txt['settings'], 'description' => $txt['smiley_settings_explain'], 'href' => $scripturl . '?action=smileys;sa=settings', 'is_last' => true)));
// Select the right tab based on the sub action.
if (isset($context['admin_tabs']['tabs'][$context['sub_action']])) {
$context['admin_tabs']['tabs'][$context['sub_action']]['is_selected'] = true;
}
// Some settings may not be enabled, disallow these from the tabs as appropriate.
if (empty($modSettings['messageIcons_enable'])) {
unset($context['admin_tabs']['tabs']['editicons']);
}
if (empty($modSettings['smiley_enable'])) {
unset($context['admin_tabs']['tabs']['addsmiley']);
unset($context['admin_tabs']['tabs']['editsmileys']);
unset($context['admin_tabs']['tabs']['setorder']);
}
// Call the right function for this sub-acton.
$subActions[$_REQUEST['sa']]();
}
示例13: ENotifyMain
function ENotifyMain()
{
global $modSettings;
// Guests can't have unread things, we don't know anything about them.
is_not_guest();
// Update our unread replies log
if (!empty($modSettings['enotify_replies'])) {
ENotifyUpdateUnreadReplies();
}
// Update our personal messages log
if (!empty($modSettings['enotify_pms'])) {
ENotifyUpdatePms();
}
// Load up the notifications at last :)
ENotifyLoad();
// Run our garbage collection randomly (setting 0.05% chance for it to run)
$random = rand(1, 5000);
if ($random == '1987') {
ENotifyGarbageCollect();
}
// Load the language and the template file.
loadLanguage('ENotify');
loadTemplate('ENotify');
template_enotify_main();
// We use this to deactivate the SMF Wrapping Templates
die;
}
示例14: ManageNews
function ManageNews()
{
global $context, $txt, $scripturl;
// First, let's do a quick permissions check for the best error message possible.
isAllowedTo(array('edit_news', 'send_mail', 'admin_forum'));
// Administrative side bar, here we come!
adminIndex('news');
loadTemplate('ManageNews');
// Format: 'sub-action' => array('function', 'permission')
$subActions = array('editnews' => array('EditNews', 'edit_news'), 'mailingmembers' => array('SelectMailingMembers', 'send_mail'), 'mailingcompose' => array('ComposeMailing', 'send_mail'), 'mailingsend' => array('SendMailing', 'send_mail'), 'settings' => array('ModifyNewsSettings', 'admin_forum'));
// Default to sub action 'main' or 'settings' depending on permissions.
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('edit_news') ? 'editnews' : (allowedTo('send_mail') ? 'mailingmembers' : 'settings'));
// Have you got the proper permissions?
isAllowedTo($subActions[$_REQUEST['sa']][1]);
// Create the tabs for the template.
$context['admin_tabs'] = array('title' => $txt['news_title'], 'help' => 'edit_news', 'description' => $txt[670], 'tabs' => array());
if (allowedTo('edit_news')) {
$context['admin_tabs']['tabs'][] = array('title' => $txt[7], 'description' => $txt[670], 'href' => $scripturl . '?action=news', 'is_selected' => $_REQUEST['sa'] == 'editnews');
}
if (allowedTo('send_mail')) {
$context['admin_tabs']['tabs'][] = array('title' => $txt[6], 'description' => $txt['news_mailing_desc'], 'href' => $scripturl . '?action=news;sa=mailingmembers', 'is_selected' => substr($_REQUEST['sa'], 0, 7) == 'mailing');
}
if (allowedTo('admin_forum')) {
$context['admin_tabs']['tabs'][] = array('title' => $txt['settings'], 'description' => $txt['news_settings_desc'], 'href' => $scripturl . '?action=news;sa=settings', 'is_selected' => $_REQUEST['sa'] == 'settings');
}
$context['admin_tabs']['tabs'][count($context['admin_tabs']['tabs']) - 1]['is_last'] = true;
$subActions[$_REQUEST['sa']][0]();
}
示例15: PackageGet
function PackageGet()
{
global $txt, $scripturl, $context, $boarddir, $sourcedir, $modSettings;
isAllowedTo('admin_forum');
require_once $sourcedir . '/Subs-Package.php';
// Use the Packages template... no reason to separate.
loadLanguage('Packages');
loadTemplate('Packages', 'admin');
$context['page_title'] = $txt['package'];
// Here is a list of all the potentially valid actions.
$subActions = array('servers' => 'PackageServers', 'add' => 'PackageServerAdd', 'browse' => 'PackageGBrowse', 'download' => 'PackageDownload', 'remove' => 'PackageServerRemove', 'upload' => 'PackageUpload');
// Now let's decide where we are taking this...
if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) {
$context['sub_action'] = $_REQUEST['sa'];
} elseif (isset($_GET['pgdownload'])) {
$context['sub_action'] = 'download';
} else {
$context['sub_action'] = 'servers';
}
// We need to force the "Download" tab as selected.
$context['menu_data_' . $context['admin_menu_id']]['current_subsection'] = 'packageget';
// Now create the tabs for the template.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['package_manager'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array(), 'packageget' => array('description' => $txt['download_packages_desc']), 'installed' => array('description' => $txt['installed_packages_desc']), 'perms' => array('description' => $txt['package_file_perms_desc']), 'options' => array('description' => $txt['package_install_options_ftp_why'])));
$subActions[$context['sub_action']]();
}