本文整理汇总了PHP中COM_newTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_newTemplate函数的具体用法?PHP COM_newTemplate怎么用?PHP COM_newTemplate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_newTemplate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MAPS_getGroupOverlayForm
/**
* This function creates a Group of Overlay Form
*
* Creates a Form for a group of overlay using the supplied defaults (if specified).
*
* @param array $group array of values describing a group of overlay
* @return string HTML string of overlay form
*/
function MAPS_getGroupOverlayForm($group = array())
{
global $_CONF, $_TABLES, $_MAPS_CONF, $LANG_MAPS_1, $LANG_configselects, $LANG_ACCESS, $_USER, $_GROUPS, $_SCRIPTS;
$display = COM_startBlock('<h1>' . $LANG_MAPS_1['group_edit'] . ' ' . $group['o_group_name'] . '</h1>');
$template = COM_newTemplate($_CONF['path'] . 'plugins/maps/templates');
$template->set_file(array('map' => 'group_overlay_form.thtml'));
$template->set_var('yes', $LANG_MAPS_1['yes']);
$template->set_var('no', $LANG_MAPS_1['no']);
//informations
$template->set_var('group_overlay_presentation', $LANG_MAPS_1['group_overlay_presentation']);
$template->set_var('informations', $LANG_MAPS_1['informations']);
$template->set_var('name_label', $LANG_MAPS_1['group_overlay_name_label']);
$template->set_var('name', stripslashes($group['o_group_name']));
$template->set_var('required_field', $LANG_MAPS_1['required_field']);
//Form validation
$template->set_var('save_button', $LANG_MAPS_1['save_button']);
if ($group['o_group_id'] > 0) {
$template->set_var('delete_button', '<option value="delete">' . $LANG_MAPS_1['delete_button'] . '</option>');
} else {
$template->set_var('delete_button', '');
}
$template->set_var('ok_button', $LANG_MAPS_1['ok_button']);
if (isset($group['o_group_id'])) {
$template->set_var('o_group_id', '<input type="hidden" name="o_group_id" value="' . $group['o_group_id'] . '" />');
} else {
$template->set_var('o_group_id', '');
}
$display .= $template->parse('output', 'map');
$display .= COM_endBlock();
return $display;
}
示例2: getRouteEditor
/**
* Shows the URL routing editor
* This will show a URL routing edit form.
*
* @param int $rid ID of URL routing rule to edit
* @return string HTML for URL routing editor
*/
function getRouteEditor($rid = 0)
{
global $_CONF, $_TABLES, $LANG_ROUTER, $LANG_ADMIN, $MESSAGE, $securityToken;
$retval = '';
$A = array('rid' => $rid, 'method' => Router::HTTP_REQUEST_GET, 'rule' => '', 'route' => '', 'priority' => Router::DEFAULT_PRIORITY);
$rid = intval($rid, 10);
if ($rid > 0) {
if (DB_count($_TABLES['routes'], 'rid', $rid) == 1) {
$sql = "SELECT * FROM {$_TABLES['routes']} WHERE rid =" . DB_escapeString($rid);
$result = DB_query($sql);
$A = DB_fetchArray($result);
} else {
// Non-existent route
$rid = 0;
$A['rid'] = $rid;
}
}
$T = COM_newTemplate($_CONF['path_layout'] . 'admin/router');
$T->set_file('editor', 'routereditor.thtml');
$routerStart = COM_startBlock($LANG_ROUTER[10], '', COM_getBlockTemplate('_admin_block', 'header')) . LB . SEC_getTokenExpiryNotice($securityToken);
$T->set_var('start_router_editor', $routerStart);
if ($rid > 0) {
$deleteButton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
$jsConfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
$T->set_var(array('delete_option' => sprintf($deleteButton, $jsConfirm), 'delete_option_no_confirmation' => sprintf($deleteButton, ''), 'allow_delete' => true));
}
$T->set_var(array('rid' => $A['rid'], 'method' => $A['method'], 'rule' => $A['rule'], 'route' => $A['route'], 'priority' => $A['priority'], 'gltoken_name' => CSRF_TOKEN, 'gltoken' => $securityToken));
$T->set_var(array('lang_router_rid' => $LANG_ROUTER[3], 'lang_router_method' => $LANG_ROUTER[4], 'lang_router_rule' => $LANG_ROUTER[5], 'lang_router_route' => $LANG_ROUTER[6], 'lang_router_priority' => $LANG_ROUTER[7], 'lang_router_notice' => $LANG_ROUTER[20], 'lang_save' => $LANG_ADMIN['save'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'lang_delete' => $LANG_ADMIN['delete'], 'confirm_message' => $MESSAGE[76]));
$T->set_var('end_block', COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')));
$T->parse('output', 'editor');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例3: MG_enroll
function MG_enroll()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03;
// let's make sure this user does not already have a member album
if ($_MG_CONF['member_albums'] != 1) {
echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
exit;
}
$sql = "SELECT album_id FROM {$_TABLES['mg_albums']} " . "WHERE owner_id=" . intval($_USER['uid']) . " AND album_parent=" . intval($_MG_CONF['member_album_root']);
$result = DB_query($sql);
$nRows = DB_numRows($result);
if ($nRows > 0) {
$display = COM_startBlock('', '', COM_getBlockTemplate('_msg_block', 'header'));
$display .= $LANG_MG03['existing_member_album'];
$display .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
$display = MG_createHTMLDocument($display);
COM_output($display);
exit;
}
$T = COM_newTemplate(MG_getTemplatePath(0));
$T->set_file('enroll', 'enroll.thtml');
$T->set_var(array('s_form_action' => $_MG_CONF['site_url'] . '/enroll.php', 'lang_title' => $LANG_MG03['enroll_title'], 'lang_overview' => $LANG_MG03['overview'], 'lang_terms' => $LANG_MG03['terms'], 'lang_member_album_overview' => $LANG_MG03['member_album_overview'], 'lang_member_album_terms' => $LANG_MG03['member_album_terms'], 'lang_agree' => $LANG_MG03['agree'], 'lang_cancel' => $LANG_MG03['cancel']));
$retval .= $T->finish($T->parse('output', 'enroll'));
return $retval;
}
示例4: adminfooter
function adminfooter()
{
global $_CONF, $LANG_GF01, $CONF_FORUM;
$footertemplate = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout/admin');
$footertemplate->set_file(array('footertemplate' => 'footer.thtml'));
$footertemplate->set_var('forumname', $LANG_GF01['forumname']);
$footertemplate->parse('output', 'footertemplate');
return $footertemplate->finish($footertemplate->get_var('output'));
}
示例5: MAPS_listUserMarkers
/**
* List all markers that the user has access to
*
* @retun string HTML for the list
*
*/
function MAPS_listUserMarkers()
{
global $_CONF, $_USER, $_MAPS_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG_MAPS_1, $LANG_LOGIN;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
if (COM_isAnonUser()) {
$retval .= COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
$login = COM_newTemplate($_CONF['path'] . 'plugins/maps/templates');
$login->set_file(array('login' => 'submitloginrequired.thtml'));
$login->set_var('xhtml', XHTML);
$login->set_var('login_message', $LANG_LOGIN[2]);
$login->set_var('site_url', $_CONF['site_url']);
$login->set_var('site_admin_url', $_CONF['site_admin_url']);
$login->set_var('layout_url', $_CONF['layout_url']);
$login->set_var('lang_login', $LANG_LOGIN[3]);
$login->set_var('lang_newuser', $LANG_LOGIN[4]);
$login->parse('output', 'login');
$retval .= $login->finish($login->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
return $retval;
}
$uid = $_USER['uid'];
if (DB_count($_TABLES['maps_markers'], 'owner_id', $uid) == 0) {
return $retval = $LANG_MAPS_1['no_marker'];
}
if ($_MAPS_CONF['monetize'] == 1) {
$header_arr = array(array('text' => $LANG_MAPS_1['name'], 'field' => 'name', 'sort' => true), array('text' => $LANG_MAPS_1['address'], 'field' => 'address', 'sort' => false), array('text' => $LANG_MAPS_1['to_label'], 'field' => 'to', 'sort' => true), array('text' => $LANG_MAPS_1['id'], 'field' => 'mkid', 'sort' => true));
} else {
$header_arr = array(array('text' => $LANG_MAPS_1['name'], 'field' => 'name', 'sort' => true), array('text' => $LANG_MAPS_1['address'], 'field' => 'address', 'sort' => false), array('text' => $LANG_MAPS_1['id'], 'field' => 'mkid', 'sort' => true));
}
if ($_MAPS_CONF['marker_edition'] == 1 || SEC_hasRights('maps.admin')) {
$header_arr[] = array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false);
}
$defsort_arr = array('field' => 'mk.name', 'direction' => 'asc');
$text_arr = array('has_extras' => true, 'form_url' => $_MAPS_CONF['site_url'] . '/markers.php');
$sql = "SELECT\n\t mk.*, m.free_marker\n FROM {$_TABLES['maps_markers']} AS mk\n\t\t\tLEFT JOIN {$_TABLES['maps_maps']} AS m\n\t\t\t\t ON mk.mid = m.mid";
$query_arr = array('table' => 'maps_markers', 'sql' => $sql, 'query_fields' => array('mk.name'), 'default_filter' => 'WHERE mk.owner_id=' . $uid);
$retval .= ADMIN_list('markers', 'plugin_getListField_userMarkers', $header_arr, $text_arr, $query_arr, $defsort_arr);
return $retval;
}
示例6: getImportExportForm
/**
* This function creates an import Form
*
* @return string HTML string of form
*/
function getImportExportForm()
{
global $_CONF, $_TABLES, $LANG_MAPS_1;
$return = COM_startBlock($LANG_MAPS_1['import_export']);
$template = COM_newTemplate($_CONF['path'] . 'plugins/maps/templates');
$template->set_file(array('import_export' => 'import_export_form.thtml'));
$template->set_var('site_admin_url', $_CONF['site_admin_url']);
$template->set_var('import', $LANG_MAPS_1['import']);
$template->set_var('import_message', $LANG_MAPS_1['import_message']);
$template->set_var('export', $LANG_MAPS_1['export']);
$template->set_var('export_message', $LANG_MAPS_1['export_message']);
$template->set_var('select_file', $LANG_MAPS_1['select_file']);
//delimiters
$template->set_var('separator_in', $LANG_MAPS_1['separator']);
$template->set_var('separator_out', $LANG_MAPS_1['separator']);
$separator_options = '<option value=";">;</option>' . LB;
$separator_options .= '<option value="tab">tab</option>' . LB;
$separator_options .= '<option value=",">,</option>' . LB;
$template->set_var('separator_options_in', $separator_options);
$template->set_var('separator_options_out', $separator_options);
//select map
$template->set_var('mid_label', $LANG_MAPS_1['name_label']);
$map_options = MAPS_recurseMaps($marker['mid']);
$template->set_var('map_options', $map_options);
//Fields to import or export
$template->set_var('choose_fields_import', $LANG_MAPS_1['choose_fields_import']);
$template->set_var('choose_fields_export', $LANG_MAPS_1['choose_fields_export']);
$template->set_var('checkall', $LANG_MAPS_1['checkall']);
$valid_fieds = MAPS_getFieldsImportExport();
foreach ($valid_fieds as $value) {
$fields_selector .= '<input type="checkbox" name="import_export[]" value="' . $value . '" />' . $value . '<br' . XHTML . '>' . LB;
}
$template->set_var('fields_selector', $fields_selector);
//Form validation
$template->set_var('ok_button', $LANG_MAPS_1['ok_button']);
$return .= $template->parse('output', 'import_export');
$return .= COM_endBlock();
return $return;
}
示例7: edittopic
/**
* Show topic administration form
*
* @param string tid ID of topic to edit
* @return string HTML for the topic editor
*/
function edittopic($tid = '')
{
global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG04, $LANG27, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS;
$retval = '';
if (empty($tid)) {
// new topic - set defaults
$A = array('tid' => '', 'topic' => '', 'sortnum' => 0, 'parent_id' => TOPIC_ROOT, 'inherit' => 1, 'hidden' => 0, 'limitnews' => '', 'is_default' => 0, 'archive_flag' => 0);
} else {
$result = DB_query("SELECT * FROM {$_TABLES['topics']} WHERE tid ='{$tid}'");
$A = DB_fetchArray($result);
$access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
if ($access == 0 || $access == 2) {
$retval .= COM_showMessageText($LANG27[13], $LANG27[12]);
COM_accessLog("User {$_USER['username']} tried to illegally create or edit topic {$tid}.");
return $retval;
}
}
$token = SEC_createToken();
$retval .= COM_startBlock($LANG27[1], '', COM_getBlockTemplate('_admin_block', 'header'));
$retval .= SEC_getTokenExpiryNotice($token);
if (!is_array($A) || empty($A['owner_id'])) {
$A['owner_id'] = $_USER['uid'];
// this is the one instance where we default the group
// most topics should belong to the Topic Admin group
if (isset($_GROUPS['Topic Admin'])) {
$A['group_id'] = $_GROUPS['Topic Admin'];
} else {
$A['group_id'] = SEC_getFeatureGroup('topic.edit');
}
SEC_setDefaultPermissions($A, $_CONF['default_permissions_topic']);
$access = 3;
}
$topic_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/topic');
$topic_templates->set_file('editor', 'topiceditor.thtml');
if (!empty($tid) && SEC_hasRights('topic.edit')) {
$delButton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
$jsConfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
$topic_templates->set_var('delete_option', sprintf($delButton, $jsConfirm));
$topic_templates->set_var('delete_option_no_confirmation', sprintf($delButton, ''));
$topic_templates->set_var('allow_delete', true);
$topic_templates->set_var('lang_delete', $LANG_ADMIN['delete']);
$topic_templates->set_var('confirm_message', $MESSAGE[76]);
$topic_templates->set_var('warning_msg', $LANG27[6]);
}
if ($_CONF['titletoid'] && empty($tid)) {
$_SCRIPTS->setJavaScriptFile('title_2_id', '/javascript/title_2_id.js');
$topic_templates->set_var('titletoid', true);
}
$topic_templates->set_var('lang_topicid', $LANG27[2]);
$topic_templates->set_var('topic_id', $A['tid']);
$topic_templates->set_var('lang_parent_id', $LANG27[32]);
$topic_templates->set_var('parent_id_options', TOPIC_getTopicListSelect($A['parent_id'], 1, false, $A['tid'], true));
$topic_templates->set_var('lang_inherit', $LANG27[33]);
$topic_templates->set_var('lang_inherit_info', $LANG27[34]);
if ($A['inherit'] == 1) {
$topic_templates->set_var('inherit_checked', 'checked="checked"');
} else {
$topic_templates->set_var('inherit_checked', '');
}
$topic_templates->set_var('lang_hidden', $LANG27[35]);
$topic_templates->set_var('lang_hidden_info', $LANG27[36]);
if ($A['hidden'] == 1) {
$topic_templates->set_var('hidden_checked', 'checked="checked"');
} else {
$topic_templates->set_var('hidden_checked', '');
}
$topic_templates->set_var('lang_donotusespaces', $LANG27[5]);
$topic_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
$topic_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
$ownername = COM_getDisplayName($A['owner_id']);
$topic_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$A['owner_id']}"));
$topic_templates->set_var('owner_name', $ownername);
$topic_templates->set_var('owner', $ownername);
$topic_templates->set_var('owner_id', $A['owner_id']);
$topic_templates->set_var('lang_group', $LANG_ACCESS['group']);
$topic_templates->set_var('lang_save', $LANG_ADMIN['save']);
$topic_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
$topic_templates->set_var('group_dropdown', SEC_getGroupDropdown($A['group_id'], $access));
$topic_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
$topic_templates->set_var('lang_permissions_key', $LANG_ACCESS['permissionskey']);
$topic_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
$topic_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
$topic_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
$topic_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']));
// show sort order only if they specified sortnum as the sort method
if ($_CONF['sortmethod'] !== 'alpha') {
$topic_templates->set_var('lang_sortorder', $LANG27[10]);
if ($A['sortnum'] == 0) {
$A['sortnum'] = '';
}
$topic_templates->set_var('sort_order', '<input type="text" size="5" maxlength="5" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
} else {
$topic_templates->set_var('lang_sortorder', $LANG27[14]);
$topic_templates->set_var('sort_order', $LANG27[15] . '<input type="hidden" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
//.........这里部分代码省略.........
示例8: MG_mediaEdit
function MG_mediaEdit($album_id, $media_id, $actionURL = '', $mqueue = 0, $view = 0, $back = '')
{
global $_USER, $_CONF, $_MG_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_MG07, $_DB_dbms;
$album = new mgAlbum($album_id);
if ($actionURL == '') {
$actionURL = $_MG_CONF['site_url'] . '/index.php';
}
$retval = '';
$T = COM_newTemplate(MG_getTemplatePath($album_id));
$T->set_file(array('admin' => 'mediaedit.thtml', 'asf_options' => 'edit_asf_options.thtml', 'mp3_options' => 'edit_mp3_options.thtml', 'swf_options' => 'edit_swf_options.thtml', 'mov_options' => 'edit_mov_options.thtml', 'flv_options' => 'edit_flv_options.thtml'));
// pull the media information from the database...
$sql = "SELECT * FROM ";
if ($_DB_dbms == "mssql") {
$sql = "SELECT *,CAST(media_desc AS TEXT) AS media_desc FROM ";
}
$sql .= ($mqueue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media']) . " WHERE media_id='" . addslashes($media_id) . "'";
$result = DB_query($sql);
$row = DB_fetchArray($result);
if ($album->access != 3 && !SEC_inGroup($album->mod_group_id) && $row['media_user_id'] != $_USER['uid']) {
COM_errorLog("Someone has tried to illegally sort albums in Media Gallery. " . "User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
return COM_showMessageText($LANG_MG00['access_denied_msg']);
}
// Build Album List
$album_jumpbox = '<select name="albums" width="40">';
$root_album = new mgAlbum(0);
$root_album->buildJumpBox($album_jumpbox, $album_id);
$album_jumpbox .= '</select>';
// should check the above for errors, etc...
$exif_info = '';
if ($row['media_type'] == 0) {
if (!function_exists('MG_readEXIF')) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
}
$exif_info = MG_readEXIF($row['media_id'], 1, $mqueue);
if (empty($exif_info)) {
$exif_info = '';
}
}
$media_time_month = date("m", $row['media_time']);
$media_time_day = date("d", $row['media_time']);
$media_time_year = date("Y", $row['media_time']);
$media_time_hour = date("H", $row['media_time']);
$media_time_minute = date("i", $row['media_time']);
$month_select = '<select name="media_month">';
$month_select .= COM_getMonthFormOptions($media_time_month);
$month_select .= '</select>';
$day_select = '<select name="media_day">';
for ($i = 1; $i < 32; $i++) {
$day_select .= '<option value="' . $i . '"' . ($media_time_day == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$day_select .= '</select>';
$current_year = (int) date("Y");
$end_year = $current_year + 10;
$year_select = '<select name="media_year">';
for ($i = 1998; $i < $end_year; $i++) {
$year_select .= '<option value="' . $i . '"' . ($media_time_year == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$year_select .= '</select>';
$hour_select = '<select name="media_hour">';
for ($i = 0; $i < 24; $i++) {
$hour_select .= '<option value="' . $i . '"' . ($media_time_hour == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$hour_select .= '</select>';
$minute_select = '<select name="media_minute">';
for ($i = 0; $i < 60; $i++) {
$minute_select .= '<option value="' . $i . '"' . ($media_time_minute == $i ? 'selected="selected"' : "") . '>' . ($i < 10 ? '0' : '') . $i . '</option>';
}
$minute_select .= '</select>';
$media_time = MG_getUserDateTimeFormat($row['media_time']);
$tn_size = 1;
list($thumbnail, $pThumbnail, $size) = Media::getThumbInfo($row, $tn_size);
$attached_thumbnail = '';
if ($row['media_tn_attached'] == 1) {
$atnsize = '';
if ($size != false) {
list($newwidth, $newheight) = Media::getImageWH($size[0], $size[1], 150, 150);
$atnsize = 'width="' . $newwidth . '" height="' . $newheight . '"';
}
$attached_thumbnail = '<img src="' . $thumbnail . '" alt="" ' . $atnsize . XHTML . '>';
$tmpthumb = Media::getDefaultThumbnail($row, $tn_size);
$thumbnail = $_MG_CONF['mediaobjects_url'] . '/' . $tmpthumb;
$size = getimagesize($_MG_CONF['path_mediaobjects'] . $tmpthumb);
}
$preview = '';
$preview_end = '';
if ($row['media_type'] == 0 || $row['media_type'] == 1 || $row['media_type'] == 2) {
// image, video and music file
if ($row['media_type'] == 2) {
$win_width = 540;
$win_height = 320;
} elseif ($row['media_type'] == 1) {
$win_width = 660;
$win_height = 525;
} elseif ($row['media_type'] == 0) {
$path = Media::getFilePath('disp', $row['media_filename'], $row['media_mime_ext']);
$media_size_disp = @getimagesize($path);
$win_width = $media_size_disp[0] + 20;
$win_height = $media_size_disp[1] + 20;
} else {
$win_width = 800;
//.........这里部分代码省略.........
示例9: CUSTOM_userForm
/**
* Main Form used for Custom membership when member is registering
*
* Note: Requires a file custom/memberdetail.thtml in every theme that is
* installed on the site!
*
* @param string $msg an error message to display or the word 'new'
* @return string HTML for the registration form
*
*/
function CUSTOM_userForm($msg = '')
{
global $_CONF, $_TABLES, $LANG04;
$retval = '';
if (!empty($msg) && $msg != 'new') {
$retval .= COM_startBlock($LANG04[21]) . $msg . COM_endBlock();
}
$post_url = $_CONF['site_url'] . '/users.php';
$postmode = 'create';
$submitbutton = '<input type="submit" value="Register Now!"' . XHTML . '>';
$message = "<blockquote style=\"padding-top:10px;\"><b>Please complete the application below. Once you have completed the application, click the Register Now! button and the application will be processed immediately.</b></blockquote>";
$user_templates = COM_newTemplate($_CONF['path_layout'] . 'custom');
$user_templates->set_file('memberdetail', 'memberdetail.thtml');
$user_templates->set_var('post_url', $post_url);
$user_templates->set_var('startblock', COM_startBlock("Custom Registration Example"));
$user_templates->set_var('message', $message);
$user_templates->set_var('USERNAME', $LANG04[2]);
$user_templates->set_var('USERNAME_HELP', "Name to be used when accessing this site");
$username = '';
if (isset($_POST['username'])) {
$username = COM_applyFilter($_POST['username']);
}
$user_templates->set_var('username', $username);
$user_templates->set_var('EMAIL', $LANG04[5]);
$user_templates->set_var('EMAIL_HELP', $LANG04[33]);
$email = '';
if (isset($_POST['email'])) {
$email = COM_applyFilter($_POST['email']);
}
$user_templates->set_var('email', $email);
$user_templates->set_var('EMAIL_CONF', $LANG04[124]);
$user_templates->set_var('EMAIL_CONF_HELP', $LANG04[126]);
$email_conf = '';
if (isset($_POST['email_conf'])) {
$email_conf = COM_applyFilter($_POST['email_conf']);
}
$user_templates->set_var('email_conf', $email_conf);
$user_templates->set_var('FULLNAME', $LANG04[3]);
$user_templates->set_var('FULLNAME_HELP', $LANG04[34]);
$fullname = '';
if (isset($_POST['fullname'])) {
$fullname = strip_tags($_POST['fullname']);
}
$user_templates->set_var('fullname', $fullname);
$user_templates->set_var('user_id', $user);
$user_templates->set_var('postmode', $postmode);
$user_templates->set_var('submitbutton', $submitbutton);
$user_templates->set_var('endblock', COM_endBlock());
$user_templates->parse('output', 'memberdetail');
$retval .= $user_templates->finish($user_templates->get_var('output'));
return $retval;
}
示例10: storyeditor
/**
* Shows story editor
*
* Displays the story entry form
*
* @param string $sid ID of story to edit
* @param string $mode 'preview', 'edit', 'editsubmission', 'clone'
* @param string $errormsg a message to display on top of the page
* @return string HTML for story editor
*
*/
function storyeditor($sid = '', $mode = '', $errormsg = '')
{
global $_CONF, $_TABLES, $_USER, $LANG24, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE, $_SCRIPTS, $LANG_DIRECTION, $LANG_MONTH, $LANG_WEEK;
$display = '';
if (!isset($_CONF['hour_mode'])) {
$_CONF['hour_mode'] = 12;
}
if (!empty($errormsg)) {
$display .= COM_showMessageText($errormsg, $LANG24[25]);
}
$story = new Story();
if ($mode == 'preview') {
// Handle Magic GPC Garbage:
while (list($key, $value) = each($_POST)) {
if (!is_array($value)) {
$_POST[$key] = COM_stripslashes($value);
} else {
while (list($subkey, $subvalue) = each($value)) {
$value[$subkey] = COM_stripslashes($subvalue);
}
}
}
$result = $story->loadFromArgsArray($_POST);
if ($_CONF['maximagesperarticle'] > 0) {
$errors = $story->checkAttachedImages();
if (count($errors) > 0) {
$msg = $LANG24[55] . LB . '<ul>' . LB;
foreach ($errors as $err) {
$msg .= '<li>' . $err . '</li>' . LB;
}
$msg .= '</ul>' . LB;
$display .= COM_showMessageText($msg, $LANG24[54]);
}
}
} else {
$result = $story->loadFromDatabase($sid, $mode);
}
if ($result == STORY_PERMISSION_DENIED || $result == STORY_NO_ACCESS_PARAMS) {
$display .= COM_showMessageText($LANG24[42], $LANG_ACCESS['accessdenied']);
COM_accessLog("User {$_USER['username']} tried to illegally access story {$sid}.");
return $display;
} elseif ($result == STORY_EDIT_DENIED || $result == STORY_EXISTING_NO_EDIT_PERMISSION) {
$display .= COM_showMessageText($LANG24[41], $LANG_ACCESS['accessdenied']);
$display .= STORY_renderArticle($story, 'p');
COM_accessLog("User {$_USER['username']} tried to illegally edit story {$sid}.");
return $display;
} elseif ($result == STORY_INVALID_SID) {
if ($mode == 'editsubmission') {
// that submission doesn't seem to be there any more (may have been
// handled by another Admin) - take us back to the moderation page
return COM_refresh($_CONF['site_admin_url'] . '/moderation.php');
} else {
return COM_refresh($_CONF['site_admin_url'] . '/story.php');
}
} elseif ($result == STORY_DUPLICATE_SID) {
$display .= COM_showMessageText($LANG24[24]);
}
// Load HTML templates
$story_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/story');
if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
$story_templates->set_file(array('editor' => 'storyeditor_advanced.thtml'));
$advanced_editormode = true;
$story_templates->set_var('change_editormode', 'onchange="change_editmode(this);"');
require_once $_CONF['path_system'] . 'classes/navbar.class.php';
$story_templates->set_var('show_preview', 'none');
$story_templates->set_var('lang_expandhelp', $LANG24[67]);
$story_templates->set_var('lang_reducehelp', $LANG24[68]);
$story_templates->set_var('lang_publishdate', $LANG24[69]);
$story_templates->set_var('lang_toolbar', $LANG24[70]);
$story_templates->set_var('toolbar1', $LANG24[71]);
$story_templates->set_var('toolbar2', $LANG24[72]);
$story_templates->set_var('toolbar3', $LANG24[73]);
$story_templates->set_var('toolbar4', $LANG24[74]);
$story_templates->set_var('toolbar5', $LANG24[75]);
if ($story->EditElements('advanced_editor_mode') == 1 or $story->EditElements('postmode') == 'adveditor') {
$story_templates->set_var('show_texteditor', 'none');
$story_templates->set_var('show_htmleditor', '');
} else {
$story_templates->set_var('show_texteditor', '');
$story_templates->set_var('show_htmleditor', 'none');
}
} else {
$story_templates->set_file(array('editor' => 'storyeditor.thtml'));
$advanced_editormode = false;
}
$story_templates->set_var('hour_mode', $_CONF['hour_mode']);
if ($story->hasContent()) {
$previewContent = STORY_renderArticle($story, 'p');
if ($advanced_editormode and $previewContent != '') {
//.........这里部分代码省略.........
示例11: submitstory
/**
* Shows the story submission form
*
*/
function submitstory()
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG12, $LANG24, $_SCRIPTS;
// Add JavaScript
$_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
$retval = '';
$story = new Story();
if (isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) {
// preview
$story->loadSubmission();
$retval .= COM_startBlock($LANG12[32]) . STORY_renderArticle($story, 'p') . COM_endBlock();
} else {
$story->initSubmission();
}
$storyform = COM_newTemplate($_CONF['path_layout'] . 'submit');
if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
$storyform->set_file('storyform', 'submitstory_advanced.thtml');
$storyform->set_var('change_editormode', 'onchange="change_editmode(this);"');
$storyform->set_var('lang_expandhelp', $LANG24[67]);
$storyform->set_var('lang_reducehelp', $LANG24[68]);
$link_message = COM_isAnonUser() ? '' : $LANG01[138];
$storyform->set_var('noscript', COM_getNoScript(false, '', $link_message));
// Setup Advanced Editor
COM_setupAdvancedEditor('/javascript/submitstory_adveditor.js');
if ($story->EditElements('postmode') === 'html') {
$storyform->set_var('show_texteditor', 'none');
$storyform->set_var('show_htmleditor', '');
} else {
$storyform->set_var('show_texteditor', '');
$storyform->set_var('show_htmleditor', 'none');
}
} else {
$storyform->set_file('storyform', 'submitstory.thtml');
if ($story->EditElements('postmode') === 'html') {
$storyform->set_var('show_texteditor', 'none');
$storyform->set_var('show_htmleditor', '');
} else {
$storyform->set_var('show_texteditor', '');
$storyform->set_var('show_htmleditor', 'none');
}
}
$storyform->set_var('lang_username', $LANG12[27]);
if (!COM_isAnonUser()) {
$storyform->set_var('story_username', $_USER['username']);
$storyform->set_var('author', COM_getDisplayName());
$storyform->set_var('status_url', $_CONF['site_url'] . '/users.php?mode=logout');
$storyform->set_var('lang_loginout', $LANG12[34]);
} else {
$storyform->set_var('status_url', $_CONF['site_url'] . '/users.php');
$storyform->set_var('lang_loginout', $LANG12[2]);
if (!$_CONF['disable_new_user_registration']) {
$storyform->set_var('separator', ' | ');
$storyform->set_var('seperator', ' | ');
$storyform->set_var('create_account', COM_createLink($LANG12[53], $_CONF['site_url'] . '/users.php?mode=new', array('rel' => 'nofollow')));
}
}
$storyform->set_var('lang_title', $LANG12[10]);
$storyform->set_var('story_title', $story->EditElements('title'));
$storyform->set_var('lang_topic', $LANG12[28]);
$tlist = TOPIC_getTopicSelectionControl('article', '', false, false, false);
$storyform->set_var('topic_selection', $tlist);
if (empty($tlist)) {
$retval .= COM_showMessage(101);
return $retval;
}
$storyform->set_var('story_topic_options', $tlist);
$storyform->set_var('lang_story', $LANG12[29]);
$storyform->set_var('lang_introtext', $LANG12[54]);
$storyform->set_var('lang_bodytext', $LANG12[55]);
$storyform->set_var('story_introtext', $story->EditElements('introtext'));
$storyform->set_var('story_bodytext', $story->EditElements('bodytext'));
$storyform->set_var('lang_postmode', $LANG12[36]);
$postmode = $story->EditElements('postmode');
$storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode));
$allowed_html = '';
foreach (array('plaintext', 'html') as $pm) {
$allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm);
}
$allowed_html .= COM_allowedAutotags();
$storyform->set_var('allowed_html', $allowed_html);
$storyform->set_var('story_uid', $story->EditElements('uid'));
$storyform->set_var('story_sid', $story->EditElements('sid'));
$storyform->set_var('story_date', $story->EditElements('unixdate'));
$storyform->set_var('lang_preview', $LANG12[32]);
PLG_templateSetVars('story', $storyform);
if ($_CONF['skip_preview'] == 1 || isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) {
$storyform->set_var('save_button', '<input name="mode" type="submit" value="' . $LANG12[8] . '"' . XHTML . '>');
}
$retval .= COM_startBlock($LANG12[6], 'submitstory.html');
$storyform->parse('theform', 'storyform');
$retval .= $storyform->finish($storyform->get_var('theform'));
$retval .= COM_endBlock();
return $retval;
}
示例12: openBreadcrumbs
function openBreadcrumbs()
{
global $_CONF;
$this->_bctemplate = COM_newTemplate($_CONF['path_layout'] . 'navbar');
$this->_bctemplate->set_file(array('breadcrumbs' => 'breadcrumbs.thtml', 'link' => 'breadcrumb_link.thtml'));
}
示例13: ADMIN_createMenu
/**
* Creates a menu with an optional icon and optional text below
* this is used in the admin screens but may be used elsewhere also.
*
* @param array $menu_arr array of text & URL of the menu entries
* @param string $text instructions to be displayed
* @param string $icon url of an icon that will be displayed
* @return string HTML output of function
*/
function ADMIN_createMenu($menu_arr, $text, $icon = '')
{
global $_CONF;
$admin_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/lists');
$admin_templates->set_file(array('top_menu' => 'topmenu.thtml'));
$menu_fields = '';
$attr = array('class' => 'admin-menu-item');
for ($i = 0; $i < count($menu_arr); $i++) {
# iterate through menu
$menu_fields .= COM_createLink($menu_arr[$i]['text'], $menu_arr[$i]['url'], $attr);
if ($i < count($menu_arr) - 1) {
$menu_fields .= ' | ';
# add separator
}
}
if (!empty($icon)) {
$attr = array('class' => 'admin-menu-icon');
$icon = COM_createImage($icon, '', $attr);
$admin_templates->set_var('icon', $icon);
}
$admin_templates->set_var('menu_fields', $menu_fields);
$admin_templates->set_var('lang_instructions', $text);
$admin_templates->parse('top_menu', 'top_menu');
$retval = $admin_templates->finish($admin_templates->get_var('top_menu'));
return $retval;
}
示例14: plugin_submit_calendarjp
break;
case 'addentry':
$display .= plugin_submit_calendarjp($mode);
$display = COM_createHTMLDocument($display, array('pagetitle' => $pagetitle));
break;
case 'savepersonal':
if (SEC_checkToken()) {
$display = plugin_savesubmission_calendarjp($_POST);
} else {
$display = COM_refresh($_CONF['site_url'] . '/calendarjp/index.php');
}
break;
default:
// month view
// Load templates
$cal_templates = COM_newTemplate($_CONF['path'] . 'plugins/calendarjp/templates');
$cal_templates->set_file(array('calendar' => 'calendar' . ($ja ? '_ja' : '') . '.thtml', 'week' => 'calendarweek.thtml', 'day' => 'calendarday.thtml', 'event' => 'calendarevent.thtml', 'mastercal' => 'mastercalendaroption.thtml', 'personalcal' => 'personalcalendaroption.thtml', 'addevent' => 'addeventoption.thtml'));
$cal_templates->set_var('mode', $mode);
if ($mode == 'personal') {
$cal_templates->set_var('start_block', COM_startBlock($LANG_CALJP_2[12]));
$cal_templates->set_var('end_block', COM_endBlock());
} else {
$cal_templates->set_var('start_block', COM_startBlock($LANG_CALJP_2[11]));
$cal_templates->set_var('end_block', COM_endBlock());
}
$smallcal_prev = getSmallCalendar($prevmonth, $prevyear, $mode);
$cal_templates->set_var('previous_months_calendar', $smallcal_prev);
$smallcal_next = getSmallCalendar($nextmonth, $nextyear, $mode);
$cal_templates->set_var('next_months_calendar', $smallcal_next);
$cal_templates->set_var('cal_prevmo_num', $prevmonth);
$cal_templates->set_var('cal_prevyr_num', $prevyear);
示例15: COM_getTooltip
/**
* Returns an text/image that will display a tooltip
*
* This tooltip is based on an example from http://downloads.sixrevisions.com/css-tooltips/index.html
*
* @param string $hoverover Text or image to display for the user to hover their mouse cursor over.
* @param string $text Text for the actual tooltip. Can include HTML.
* @param string $link Link for the tooltip. If passed, then the hoverover text becomes a link.
* @param string $title Text for the tooltip title (if there is one). Can include HTML.
* @param string $template Specify a different template to use (classic, critical, help, information, warning).
* @param string $class Specify a different tooltip class to use.
* @return string HTML tooltip
*
*/
function COM_getTooltip($hoverover = '', $text = '', $link = '', $title = '', $template = 'classic', $class = 'gl-tooltip')
{
global $_CONF, $_IMAGE_TYPE, $_SCRIPTS;
if (!defined('TOOLTIPS_FIXED')) {
define('TOOLTIPS_FIXED', true);
$_SCRIPTS->setJavaScriptLibrary('jquery');
$_SCRIPTS->setJavaScriptFile('fix_tooltips', '/javascript/fix_tooltips.js');
}
if ($hoverover == '') {
$hoverover = '<img alt="?" id="gl-tooltip-icon" src="' . $_CONF['layout_url'] . '/tooltips/images/tooltip.' . $_IMAGE_TYPE . '"' . XHTML . '>';
}
$tooltip = COM_newTemplate($_CONF['path_layout'] . 'tooltips/');
$tooltip->set_file(array('tooltip' => $template . '.thtml'));
$tooltip->set_var('class', $class);
$tooltip->set_var('hoverover', $hoverover);
$tooltip->set_var('text', $text);
$tooltip->set_var('title', $title);
if ($link == '') {
$link = '#';
$cursor = 'help';
} else {
$cursor = 'pointer';
}
$tooltip->set_var('link', $link);
$tooltip->set_var('cursor', $cursor);
$retval = $tooltip->finish($tooltip->parse('output', 'tooltip'));
return $retval;
}