本文整理汇总了PHP中PLG_templateSetVars函数的典型用法代码示例。如果您正苦于以下问题:PHP PLG_templateSetVars函数的具体用法?PHP PLG_templateSetVars怎么用?PHP PLG_templateSetVars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PLG_templateSetVars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FF_postEditor
//.........这里部分代码省略.........
} else {
$notify_val = '';
}
$notify_prompt = $LANG_GF02['msg38'] . '<br/><input type="checkbox" name="notify" ' . $notify_val . '/>';
$locked_prompt = '';
} else {
$notify_prompt = '';
$locked_prompt = '';
}
}
if ($postData['postmode'] == 'html' || $postData['postmode'] == 'HTML') {
$postmode_msg = $LANG_GF01['TEXTMODE'];
$postData['postmode'] = 'html';
} else {
$peTemplate->unset_var('show_htmleditor');
$postmode_msg = $LANG_GF01['HTMLMODE'];
}
if ($_FF_CONF['allow_html'] || SEC_inGroup('Root') || SEC_hasRights('forum.html')) {
if ($action == 'edittopic') {
$mode_prompt = $postmode_msg . '<br/><input type="checkbox" name="postmode_switch" value="1"/><input type="hidden" name="postmode" value="' . $postData['postmode'] . '"/>';
}
}
if ($action == 'edittopic') {
$peTemplate->set_var('bbcodeeditor', true);
}
$postData['subject'] = str_replace('"', '"', $postData['subject']);
if (!$_FF_CONF['allow_smilies']) {
$smilies = '';
} else {
$smilies = forumPLG_showsmilies(0);
}
$disable_bbcode_prompt = $LANG_GF01['disable_bbcode'] . ' <input type="checkbox" name="disable_bbcode" value="1" ' . $disable_bbcode_val . '/>';
if ($_FF_CONF['allow_smilies']) {
$disable_smilies_prompt = $LANG_GF01['disable_smilies'] . ' <input type="checkbox" name="disable_smilies" value="1"' . $disable_smilies_val . ' />';
} else {
$disable_smilies_prompt = '';
}
$disable_urlparse_prompt = $LANG_GF01['disable_urlparse'] . ' <input type="checkbox" name="disable_urlparse" value="1"' . $disable_urlparse_val . ' />';
$peTemplate->set_var('comment', @htmlspecialchars($postData['comment'], ENT_QUOTES, COM_getEncodingt()));
$peTemplate->set_var(array('edit_val' => $edit_val, 'sticky_val' => $sticky_val, 'postmode_msg' => $postmode_msg, 'notify_val' => $notify_val, 'disable_bbcode_val' => $disable_bbcode_val, 'disable_smilies_val' => $disable_smilies_val, 'disable_urlparse_val' => $disable_urlparse_val, 'bbcode_prompt' => $disable_bbcode_prompt, 'smilies_prompt' => $disable_smilies_prompt, 'urlparse_prompt' => $disable_urlparse_prompt, 'LANG_SUBJECT' => $LANG_GF01['SUBJECT'], 'LANG_OPTIONS' => $LANG_GF01['OPTIONS'], 'mode_prompt' => isset($mode_prompt) ? $mode_prompt : '', 'notify_prompt' => $notify_prompt, 'locked_prompt' => $locked_prompt, 'sticky_prompt' => isset($sticky_prompt) ? $sticky_prompt : '', 'edit_prompt' => $edit_prompt, 'LANG_SUBMIT' => $LANG_GF01['SUBMIT'], 'LANG_PREVIEW' => $LANG_GF01['PREVIEW'], 'subject' => $postData['subject'], 'smilies' => $smilies, 'LANG_attachments' => $LANG_GF10['attachments'], 'LANG_maxattachments' => sprintf($LANG_GF10['maxattachments'], $_FF_CONF['maxattachments']), 'postmode' => $postData['postmode']));
// Check and see if the filemgmt plugin is installed and enabled
if (function_exists('filemgmt_buildAccessSql') && $_FF_CONF['enable_fm_integration'] == 1) {
$peTemplate->set_var('filemgmt_category_options', gf_makeFilemgmtCatSelect($uid));
$peTemplate->set_var('LANG_usefilemgmt', $LANG_GF10['usefilemgmt']);
$peTemplate->set_var('LANG_description', $LANG_GF10['description']);
$peTemplate->set_var('LANG_category', $LANG_GF10['category']);
} else {
$peTemplate->set_var('show_filemgmt_option', 'none');
}
if (COM_isAnonUser()) {
$peTemplate->set_var('hide_notify', 'none');
}
if (function_exists('plugin_templatesetvars_captcha')) {
plugin_templatesetvars_captcha('forum', $peTemplate);
} else {
$peTemplate->set_var('captcha', '');
}
if ($postData['id'] > 0) {
$peTemplate->set_var('topic_id', $postData['id']);
}
$peTemplate->set_var(array('navbreadcrumbsimg' => _ff_getImage('nav_breadcrumbs'), 'navtopicimg' => _ff_getImage('nav_topic'), 'form_action' => $_CONF['site_url'] . '/forum/createtopic.php', 'referer' => $forumData['referer'], 'forum_id' => $forumData['forum'], 'cat_name' => $postData['cat_name'], 'cat_id' => $forumData['forum_cat'], 'forum_name' => $postData['forum_name'], 'subject' => @htmlspecialchars($postData['subject'], ENT_QUOTES, COM_getEncodingt()), 'LANG_HOME' => $LANG_GF01['HOMEPAGE'], 'forum_home' => $LANG_GF01['INDEXPAGE'], 'hidden_id' => $postData['id'], 'page' => $forumData['page'], 'LANG_bhelp' => $LANG_GF01['b_help'], 'LANG_ihelp' => $LANG_GF01['i_help'], 'LANG_uhelp' => $LANG_GF01['u_help'], 'LANG_qhelp' => $LANG_GF01['q_help'], 'LANG_chelp' => $LANG_GF01['c_help'], 'LANG_lhelp' => $LANG_GF01['l_help'], 'LANG_ohelp' => $LANG_GF01['o_help'], 'LANG_phelp' => $LANG_GF01['p_help'], 'LANG_whelp' => $LANG_GF01['w_help'], 'LANG_ahelp' => $LANG_GF01['a_help'], 'LANG_shelp' => $LANG_GF01['s_help'], 'LANG_fhelp' => $LANG_GF01['f_help'], 'LANG_hhelp' => $LANG_GF01['h_help'], 'LANG_thelp' => $LANG_GF01['t_help'], 'LANG_ehelp' => $LANG_GF01['e_help'], 'LANG_code' => $LANG_GF01['CODE'], 'LANG_fontcolor' => $LANG_GF01['FONTCOLOR'], 'LANG_fontsize' => $LANG_GF01['FONTSIZE'], 'LANG_closetags' => $LANG_GF01['CLOSETAGS'], 'LANG_codetip' => $LANG_GF01['CODETIP'], 'LANG_tiny' => $LANG_GF01['TINY'], 'LANG_small' => $LANG_GF01['SMALL'], 'LANG_normal' => $LANG_GF01['NORMAL'], 'LANG_large' => $LANG_GF01['LARGE'], 'LANG_huge' => $LANG_GF01['HUGE'], 'LANG_default' => $LANG_GF01['DEFAULT'], 'LANG_dkred' => $LANG_GF01['DKRED'], 'LANG_red' => $LANG_GF01['RED'], 'LANG_orange' => $LANG_GF01['ORANGE'], 'LANG_brown' => $LANG_GF01['BROWN'], 'LANG_yellow' => $LANG_GF01['YELLOW'], 'LANG_green' => $LANG_GF01['GREEN'], 'LANG_olive' => $LANG_GF01['OLIVE'], 'LANG_cyan' => $LANG_GF01['CYAN'], 'LANG_blue' => $LANG_GF01['BLUE'], 'LANG_dkblue' => $LANG_GF01['DKBLUE'], 'LANG_indigo' => $LANG_GF01['INDIGO'], 'LANG_violet' => $LANG_GF01['VIOLET'], 'LANG_white' => $LANG_GF01['WHITE'], 'LANG_black' => $LANG_GF01['BLACK']));
$peTemplate->set_var('token_name', CSRF_TOKEN);
$peTemplate->set_var('token', SEC_createToken());
$peTemplate->set_var('postmode', $postData['postmode']);
$peTemplate->unset_var('show_htmleditor');
if ($_FF_CONF['use_wysiwyg_editor'] && $postData['postmode'] == 'html') {
// hook into wysiwyg here
switch (PLG_getEditorType()) {
case 'ckeditor':
$peTemplate->set_var('show_htmleditor', true);
PLG_requestEditor('forum', 'forum_entry', 'ckeditor_forum.thtml');
PLG_templateSetVars('forum_entry', $peTemplate);
break;
case 'tinymce':
$peTemplate->set_var('show_htmleditor', true);
PLG_requestEditor('forum', 'forum_entry', 'tinymce_forum.thtml');
PLG_templateSetVars('forum_entry', $peTemplate);
break;
default:
// don't support others right now
break;
}
}
$peTemplate->parse('output', 'posteditor');
$retval .= $peTemplate->finish($peTemplate->get_var('output'));
$urlfor = 'advancededitor';
if ($uid == 1) {
$urlfor = 'advancededitor' . md5($REMOTE_ADDR);
}
SEC_setCookie($_CONF['cookie_name'] . 'adveditor', SEC_createTokenGeneral($urlfor), time() + 1200, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure'], false);
if (!isset($_POST['editpost'])) {
$_POST['editpost'] = '';
}
if ($action != 'newtopic' && $_POST['editpost'] != 'yes' && ($action == 'newreply' || $viewMode)) {
if ($FF_userprefs['showiframe']) {
$retval .= "<iframe src=\"{$_CONF['site_url']}/forum/viewtopic.php?mode=preview&showtopic=" . $postData['id'] . "&onlytopic=1&lastpost=true\" height=\"300\" width=\"100%\"></iframe>";
}
}
return $retval;
}
示例2: newuserform
/**
* Shows the user registration form
*
* @param int $msg message number to show
* @param string $referrer page to send user to after registration
* @return string HTML for user registration page
*/
function newuserform($msg = '')
{
global $_CONF, $LANG01, $LANG04;
$retval = '';
if ($_CONF['disable_new_user_registration']) {
COM_setMsg($LANG04[122], 'error');
echo COM_refresh($_CONF['site_url']);
}
if ($_CONF['custom_registration'] and function_exists('CUSTOM_userForm')) {
return CUSTOM_userForm($msg);
}
if (!empty($msg)) {
$retval .= COM_showMessageText($msg, $LANG04[21], false, 'info');
}
$user_templates = new Template($_CONF['path_layout'] . 'users');
$user_templates->set_file('regform', 'registrationform.thtml');
$user_templates->set_var('start_block', COM_startBlock($LANG04[22]));
$user_templates->set_var('lang_instructions', $LANG04[23]);
$user_templates->set_var('lang_username', $LANG04[2]);
$user_templates->set_var('lang_fullname', $LANG04[3]);
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('lang_email_conf', $LANG04[124]);
if ($_CONF['registration_type'] == 1) {
// verification link
$user_templates->set_var('lang_passwd', $LANG01[57]);
$user_templates->set_var('lang_passwd_conf', $LANG04[176]);
$user_templates->set_var('lang_warning', $LANG04[167]);
} else {
$user_templates->set_var('lang_warning', $LANG04[24]);
}
$user_templates->set_var('lang_register', $LANG04[27]);
PLG_templateSetVars('registration', $user_templates);
$user_templates->set_var('end_block', COM_endBlock());
$username = '';
if (!empty($_POST['username'])) {
$username = trim($_POST['username']);
}
$user_templates->set_var('username', @htmlentities($username, ENT_COMPAT, COM_getEncodingt()));
$fullname = '';
if (!empty($_POST['fullname'])) {
$fullname = $_POST['fullname'];
}
$fullname = USER_sanitizeName($fullname);
$user_templates->set_var('fullname', @htmlentities($fullname, ENT_COMPAT, COM_getEncodingt()));
switch ($_CONF['user_reg_fullname']) {
case 2:
$user_templates->set_var('require_fullname', 'true');
case 1:
$user_templates->set_var('show_fullname', 'true');
}
$email = '';
if (!empty($_POST['email'])) {
$email = COM_applyFilter($_POST['email']);
}
$user_templates->set_var('email', $email);
$email_conf = '';
if (!empty($_POST['email_conf'])) {
$email_conf = COM_applyFilter($_POST['email_conf']);
}
$user_templates->set_var('email_conf', $email_conf);
$user_templates->parse('output', 'regform');
$retval .= $user_templates->finish($user_templates->get_var('output'));
return $retval;
}
示例3: showForm
//.........这里部分代码省略.........
$searchform->set_var('lang_all_words', $LANG09[44]);
$searchform->set_var('lang_any_word', $LANG09[45]);
$searchform->set_var('lang_titles', $LANG09[69]);
$escquery = htmlspecialchars($this->_query);
$escquery = str_replace(array('{', '}'), array('{', '}'), $escquery);
$searchform->set_var('query', $escquery);
$searchform->set_var('datestart', $this->_dateStart);
$searchform->set_var('dateend', $this->_dateEnd);
if ($this->_titlesOnly) {
$searchform->set_var('title_checked', ' checked="checked"');
} else {
$searchform->set_var('title_checked', '');
}
$phrase_selected = '';
$all_selected = '';
$any_selected = '';
if ($this->_keyType == 'phrase') {
$phrase_selected = 'selected="selected"';
} else {
if ($this->_keyType == 'all') {
$all_selected = 'selected="selected"';
} else {
if ($this->_keyType == 'any') {
$any_selected = 'selected="selected"';
}
}
}
$searchform->set_var('key_phrase_selected', $phrase_selected);
$searchform->set_var('key_all_selected', $all_selected);
$searchform->set_var('key_any_selected', $any_selected);
$options = '';
$plugintypes = array('all' => $LANG09[4], 'stories' => $LANG09[6], 'comments' => $LANG09[7]);
$plugintypes = array_merge($plugintypes, PLG_getSearchTypes());
// Generally I don't like to hardcode HTML but this seems easiest
foreach ($plugintypes as $key => $val) {
$options .= "<option value=\"{$key}\"";
if ($this->_type == $key) {
$options .= ' selected="selected"';
}
$options .= ">{$val}</option>" . LB;
}
$searchform->set_var('plugin_types', $options);
if ($_CONF['contributedbyline'] == 1) {
$searchform->set_var('lang_authors', $LANG09[8]);
$searchusers = array();
$result = DB_query("SELECT DISTINCT uid FROM {$_TABLES['comments']}");
while ($A = DB_fetchArray($result)) {
$searchusers[$A['uid']] = $A['uid'];
}
$result = DB_query("SELECT DISTINCT uid FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)");
while ($A = DB_fetchArray($result)) {
$searchusers[$A['uid']] = $A['uid'];
}
$inlist = implode(',', $searchusers);
if (!empty($inlist)) {
$sql = "SELECT uid,username,fullname FROM {$_TABLES['users']} WHERE uid IN ({$inlist})";
if (isset($_CONF['show_fullname']) && $_CONF['show_fullname'] == 1) {
/* Caveat: This will group all users with an emtpy fullname
* together, so it's not exactly sorted by their
* full name ...
*/
$sql .= ' ORDER BY fullname,username';
} else {
$sql .= ' ORDER BY username';
}
$result = DB_query($sql);
$options = '';
while ($A = DB_fetchArray($result)) {
$options .= '<option value="' . $A['uid'] . '"';
if ($A['uid'] == $this->_author) {
$options .= ' selected="selected"';
}
$options .= '>' . htmlspecialchars(COM_getDisplayName('', $A['username'], $A['fullname'])) . '</option>';
}
$searchform->set_var('author_option_list', $options);
$searchform->parse('author_form_element', 'authors', true);
} else {
$searchform->set_var('author_form_element', '<input type="hidden" name="author" value="0"' . XHTML . '>');
}
} else {
$searchform->set_var('author_form_element', '<input type="hidden" name="author" value="0"' . XHTML . '>');
}
// Results per page
$options = '';
$limits = explode(',', $_CONF['search_limits']);
foreach ($limits as $limit) {
$options .= "<option value=\"{$limit}\"";
if ($_CONF['num_search_results'] == $limit) {
$options .= ' selected="selected"';
}
$options .= ">{$limit}</option>" . LB;
}
$searchform->set_var('search_limits', $options);
$searchform->set_var('lang_search', $LANG09[10]);
PLG_templateSetVars('search', $searchform);
$searchform->parse('output', 'searchform');
$retval .= $searchform->finish($searchform->get_var('output'));
$retval .= COM_endBlock();
return $retval;
}
示例4: MG_getBirdseed
if ($total_print_pages == 0) {
$total_print_pages = 1;
}
$birdseed = MG_getBirdseed(0, 0, 0, $total_print_pages);
$ownername = DB_getItem($_TABLES['users'], 'username', "uid=" . intval($root_album->owner_id));
$album_last_update = MG_getUserDateTimeFormat($root_album->last_update);
$pagination = COM_printPageNavigation($_MG_CONF['site_url'] . '/index.php', $page + 1, $total_pages);
$rsslink = '';
if ($_MG_CONF['rss_full_enabled']) {
$rsslink = COM_createLink(COM_createImage(MG_getImageFile('feed.png'), '', array('class' => 'mg_rssimg')), MG_getFeedUrl($_MG_CONF['rss_feed_name'] . '.rss'), array('type' => 'application/rss+xml'));
}
$T = COM_newTemplate(MG_getTemplatePath_byName($root_album->skin));
$T->set_file('page', 'album_page.thtml');
$T->set_var(array('site_url' => $_MG_CONF['site_url'], 'birdseed' => $birdseed, 'album_title' => PLG_replaceTags($root_album->title), 'table_columns' => $columns_per_page, 'table_column_width' => intval(100 / $columns_per_page) . '%', 'top_pagination' => $pagination, 'bottom_pagination' => $pagination, 'page_number' => sprintf("%s %d %s %d", $LANG_MG03['page'], $current_print_page, $LANG_MG03['of'], $total_print_pages), 'jumpbox' => MG_buildAlbumJumpbox($root_album, $album_id, 1, -1), 'album_id' => $album_id, 'album_description' => $root_album->display_album_desc ? PLG_replaceTags($root_album->description) : '', 'album_id_display' => $root_album->owner_id || $_MG_CONF['enable_media_id'] == 1 ? $LANG_MG03['album_id_display'] . $album_id : '', 'select_adminbox' => COM_isAnonUser() ? '' : MG_buildAdminbox($root_album), 'album_last_update' => $album_last_update[0], 'album_owner' => $ownername, 'media_count' => $root_album->getMediaCount(), 'lang_menulabel' => $LANG_MG03['menulabel'], 'lang_search' => $LANG_MG01['search'], 'rsslink' => $rsslink, 'list_title' => $LANG_MG03['list_title'], 'list_desc' => $LANG_MG03['list_desc'], 'list_size' => $LANG_MG03['list_size'], 'list_user' => $LANG_MG03['list_user'], 'list_updated' => $LANG_MG03['list_updated']));
// completed setting header / footer vars, parse them
PLG_templateSetVars('mediagallery', $T);
// main processing of the album contents.
if ($total_media > 0) {
$k = 0;
$col = 0;
$T->set_block('page', 'ImageColumn', 'IColumn');
$T->set_block('page', 'ImageRow', 'IRow');
for ($i = 0; $i < $media_per_page; $i += $columns_per_page) {
$next_columns = $i + $columns_per_page;
for ($j = $i; $j < $next_columns; $j++) {
if ($j >= $total_media) {
$T->parse('IRow', 'ImageRow', true);
$T->set_var('IColumn', '');
break 2;
}
$T->set_var('clear_float', '');
示例5: submitstory
/**
* Shows the story submission form
*
*/
function submitstory($topic = '')
{
global $_CONF, $_TABLES, $_USER, $LANG12, $LANG24;
$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($topic);
}
$storyform = new Template($_CONF['path_layout'] . 'submit');
if (isset($_CONF['advanced_editor']) && $_CONF['advanced_editor'] == 1 && file_exists($_CONF['path_layout'] . 'submit/submitstory_advanced.thtml')) {
$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]);
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('xhtml', XHTML);
$storyform->set_var('site_url', $_CONF['site_url']);
$storyform->set_var('site_admin_url', $_CONF['site_admin_url']);
$storyform->set_var('layout_url', $_CONF['layout_url']);
$storyform->set_var('lang_username', $LANG12[27]);
if (!empty($_USER['username'])) {
$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 = COM_topicList('tid,topic', $story->EditElements('tid'));
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]);
$storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $story->EditElements('postmode')));
$storyform->set_var('allowed_html', COM_allowedHTML());
$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;
}
示例6: SEC_loginForm
//.........这里部分代码省略.........
$retval = '';
$default_options = array('forgotpw_link' => true, 'hidden_fields' => '', 'oauth_login' => true, '3rdparty_login' => true, 'newreg_link' => true, 'verification_link' => false, 'plugin_vars' => true, 'prefill_user' => false, 'title' => $LANG04[65], 'message' => '', 'footer_message' => '', 'button_text' => $LANG04[80], 'form_action' => $_CONF['site_url'] . '/users.php');
$options = array_merge($default_options, $use_options);
$loginform = new Template($_CONF['path_layout'] . 'users');
$loginform->set_file('login', 'loginform.thtml');
$loginform->set_var('form_action', $options['form_action']);
$loginform->set_var('footer_message', $options['footer_message']);
$loginform->set_var('start_block_loginagain', COM_startBlock($options['title']));
$loginform->set_var('lang_message', $options['message']);
if ($options['newreg_link'] == false || $_CONF['disable_new_user_registration']) {
$loginform->set_var('lang_newreglink', '');
} else {
$loginform->set_var('lang_newreglink', $LANG04[123]);
}
$loginform->set_var('lang_username', $LANG04[2]);
$loginform->set_var('lang_password', $LANG01[57]);
if ($options['forgotpw_link']) {
$loginform->set_var('lang_forgetpassword', $LANG04[25]);
$forget = COM_createLink($LANG04[25], $_CONF['site_url'] . '/users.php?mode=getpassword', array('rel' => 'nofollow'));
$loginform->set_var('forgetpassword_link', $forget);
} else {
$loginform->set_var('lang_forgetpassword', '');
$loginform->set_var('forgetpassword_link', '');
}
$loginform->set_var('lang_login', $options['button_text']);
$loginform->set_var('end_block', COM_endBlock());
// 3rd party remote authentication.
$services = '';
if ($options['3rdparty_login'] && $_CONF['user_login_method']['3rdparty'] && $_CONF['usersubmission'] == 0) {
$modules = SEC_collectRemoteAuthenticationModules();
if (count($modules) > 0) {
if (!$_CONF['user_login_method']['standard'] && count($modules) == 1) {
$select = '<input type="hidden" name="service" value="' . $modules[0] . '"/>' . $modules[0] . LB;
} else {
// Build select
$select = '<select name="service">';
if ($_CONF['user_login_method']['standard']) {
$select .= '<option value="">' . $_CONF['site_name'] . '</option>' . LB;
}
foreach ($modules as $service) {
$select .= '<option value="' . $service . '">' . $service . '</option>' . LB;
}
$select .= '</select>';
}
$loginform->set_file('services', 'services.thtml');
$loginform->set_var('lang_service', $LANG04[121]);
$loginform->set_var('select_service', $select);
$loginform->parse('output', 'services');
$services .= $loginform->finish($loginform->get_var('output'));
}
}
if (!empty($options['hidden_fields'])) {
// allow caller to (ab)use {services} for hidden fields
$services .= $options['hidden_fields'];
$loginform->set_var('hidden_fields', $options['hidden_fields']);
}
$loginform->set_var('services', $services);
// OAuth remote authentication.
if ($options['oauth_login'] && $_CONF['user_login_method']['oauth']) {
$modules = SEC_collectRemoteOAuthModules();
if (count($modules) == 0) {
$loginform->set_var('oauth_login', '');
} else {
$html_oauth = '';
foreach ($modules as $service) {
$loginform->set_file('oauth_login', '../loginform_oauth.thtml');
$loginform->set_var('oauth_service', $service);
$loginform->set_var('oauth_service_display', ucwords($service));
// for sign in image
$loginform->set_var('oauth_sign_in_image', $_CONF['site_url'] . '/images/login-with-' . $service . '.png');
$loginform->parse('output', 'oauth_login');
$html_oauth .= $loginform->finish($loginform->get_var('output'));
}
$loginform->set_var('oauth_login', $html_oauth);
}
} else {
$loginform->set_var('oauth_login', '');
}
if ($options['verification_link']) {
$loginform->set_var('lang_verification', $LANG04[169]);
$verify = COM_createLink($LANG04[25], $_CONF['site_url'] . '/users.php?mode=getnewtoken', array('rel' => 'nofollow'));
$loginform->set_var('verification_link', $verify);
} else {
$loginform->set_var('lang_verification', '');
$loginform->set_var('verification_link', '');
}
if ($options['prefill_user'] && isset($_USER['username']) && $_USER['username'] != '') {
$loginform->set_var('loginname', $_USER['username']);
$loginform->set_var('focus', 'passwd');
} else {
$loginform->set_var('loginname', '');
$loginform->set_var('focus', 'loginname');
}
if ($options['plugin_vars']) {
PLG_templateSetVars('loginform', $loginform);
}
$loginform->parse('output', 'login');
$retval .= $loginform->finish($loginform->get_var('output'));
return $retval;
}
示例7: STORY_renderArticle
//.........这里部分代码省略.........
}
if (($_CONF['trackback_enabled'] || $_CONF['pingback_enabled']) && $story->DisplayElements('trackbackcode') >= 0 && $show_comments) {
$num_trackbacks = COM_numberFormat($story->DisplayElements('trackbacks'));
$trackbacksUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid()) . '#trackback';
$article->set_var('trackbacks_url', $trackbacksUrl);
$article->set_var('trackbacks_text', $num_trackbacks . ' ' . $LANG_TRB['trackbacks']);
$article->set_var('trackbacks_count', $num_trackbacks);
$article->set_var('lang_trackbacks', $LANG_TRB['trackbacks']);
if (SEC_hasRights('story.ping')) {
$pingurl = $_CONF['site_admin_url'] . '/trackback.php?mode=sendall&id=' . $story->getSid();
$pingico = '<img src="' . $_CONF['layout_url'] . '/images/sendping.' . $_IMAGE_TYPE . '" alt="' . $LANG_TRB['send_trackback'] . '" title="' . $LANG_TRB['send_trackback'] . '"' . XHTML . '>';
$article->set_var('send_trackback_icon', COM_createLink($pingico, $pingurl));
}
$trackbacks_with_count = sprintf($LANG01[122], $num_trackbacks);
if ($story->DisplayElements('trackbacks') > 0) {
$trackbacks_with_count = COM_createLink($trackbacks_with_count, $trackbacksUrl);
}
$article->set_var('trackbacks_with_count', $trackbacks_with_count);
}
if ($_CONF['hideemailicon'] == 1 || COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
$article->set_var('email_icon', '');
} else {
$emailUrl = $_CONF['site_url'] . '/profiles.php?sid=' . $story->getSid() . '&what=emailstory';
$emailicon = '<img src="' . $_CONF['layout_url'] . '/images/mail.' . $_IMAGE_TYPE . '" alt="' . $LANG01[64] . '" title="' . $LANG11[2] . '"' . XHTML . '>';
$article->set_var('email_icon', COM_createLink($emailicon, $emailUrl));
$article->set_var('email_story_url', $emailUrl);
$article->set_var('lang_email_story', $LANG11[2]);
$article->set_var('lang_email_story_alt', $LANG01[64]);
}
$printUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid() . '&mode=print');
if ($_CONF['hideprintericon'] == 1) {
$article->set_var('print_icon', '');
} else {
$printicon = '<img src="' . $_CONF['layout_url'] . '/images/print.' . $_IMAGE_TYPE . '" alt="' . $LANG01[65] . '" title="' . $LANG11[3] . '"' . XHTML . '>';
$article->set_var('print_icon', COM_createLink($printicon, $printUrl, array('rel' => 'nofollow')));
$article->set_var('print_story_url', $printUrl);
$article->set_var('lang_print_story', $LANG11[3]);
$article->set_var('lang_print_story_alt', $LANG01[65]);
}
$article->set_var('story_display', 'index');
$storyCounter++;
$article->set_var('story_counter', $storyCounter);
}
$article->set_var('recent_post_anchortag', $recent_post_anchortag);
if ($index != 'p' && SEC_hasRights('story.edit') && $story->checkAccess() == 3 && TOPIC_hasMultiTopicAccess('article', $story->DisplayElements('sid')) == 3) {
$editUrl = $_CONF['site_admin_url'] . '/story.php?mode=edit&sid=' . $story->getSid();
$editiconhtml = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG01[4] . '" title="' . $LANG01[4] . '"' . XHTML . '>';
$article->set_var('edit_link', COM_createLink($LANG01[4], $editUrl));
$article->set_var('edit_url', $editUrl);
$article->set_var('lang_edit_text', $LANG01[4]);
$article->set_var('edit_icon', COM_createLink($editiconhtml, $editUrl, array('class' => 'editlink')));
$article->set_var('edit_image', $editiconhtml);
}
$navi_list = true;
$feedback_list = true;
if ($index == 'p') {
$navi_list = false;
$feedback_list = false;
} else {
$navi_list = $page_selector !== '' || $readmore_link !== '' || $post_comment_link !== '';
$feedback_list = $plugin_itemdisplay !== '' || $comments_with_count !== '' || $trackbacks_with_count !== '';
}
$story_footer = $navi_list || $feedback_list || $related_topics !== '';
$article->set_var('navi_list', $navi_list);
$article->set_var('feedback_list', $feedback_list);
$article->set_var('story_footer', $story_footer);
if ($story->DisplayElements('featured') == 1) {
$article->set_var('lang_todays_featured_article', $LANG05[4]);
$article->parse('story_bodyhtml', 'featuredbodytext', true);
PLG_templateSetVars('featuredstorytext', $article);
} elseif ($story->DisplayElements('statuscode') == STORY_ARCHIVE_ON_EXPIRE && $story->DisplayElements('expire') <= time()) {
$article->parse('story_bodyhtml', 'archivestorybodytext', true);
PLG_templateSetVars('archivestorytext', $article);
} else {
$article->parse('story_bodyhtml', 'bodytext', true);
PLG_templateSetVars('storytext', $article);
}
// Add related articles
if ($index === 'n') {
$article->set_var('related_articles_by_keyword', Story::getRelatedArticlesByKeywords($story->getSid(), $story->DisplayElements('meta_keywords')));
}
PLG_templateSetVars($article_filevar, $article);
if ($index != 'p' && ($cache_time > 0 || $cache_time == -1)) {
$article->create_instance($cacheInstance, $article_filevar);
// CACHE_create_instance($cacheInstance, $article);
}
} else {
PLG_templateSetVars($article_filevar, $article);
if (!$_CONF['cache_templates']) {
// Hack (see Geeklog Bug Tracker issue #0001817): Cannot set the template variable directly with set_var since
// this template variable was set with set_file which uses the templatecode array (set_var uses varvals array)
// so have to update the templatecode array directly. This array really shouldn't be accessed this way
// and this hack should be changed in the future: either set_var or set_file functions need to allow update of the file template variable found in templatecode
// $article->set_var($article_filevar, $retval);
$article->templateCode[$article_filevar] = $retval;
}
}
$article->parse('finalstory', $article_filevar);
return $article->finish($article->get_var('finalstory'));
}
示例8: mailstoryform
/**
* Display form to email a story to someone.
*
* @param string $sid ID of article to email
* @return string HTML for email story form
*
*/
function mailstoryform($sid, $to = '', $toemail = '', $from = '', $fromemail = '', $shortmsg = '', $msg = 0)
{
global $_CONF, $_TABLES, $_USER, $LANG03, $LANG08, $LANG_LOGIN;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
$display = COM_siteHeader('menu', $LANG_LOGIN[1]);
$display .= SEC_loginRequiredForm();
$display .= COM_siteFooter();
echo $display;
exit;
}
$result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE sid = '" . DB_escapeString($sid) . "'" . COM_getTopicSql('AND') . COM_getPermSql('AND'));
$A = DB_fetchArray($result);
if ($A['count'] == 0) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
if ($msg > 0) {
$retval .= COM_showMessage($msg, '', '', 0, 'info');
}
if (empty($from) && empty($fromemail)) {
if (!COM_isAnonUser()) {
$from = COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname']);
$fromemail = DB_getItem($_TABLES['users'], 'email', "uid = {$_USER['uid']}");
}
}
$postmode = $_CONF['mailuser_postmode'];
$mail_template = new Template($_CONF['path_layout'] . 'profiles');
$mail_template->set_file('form', 'contactauthorform.thtml');
if ($postmode == 'html') {
$mail_template->set_var('show_htmleditor', true);
} else {
$mail_template->unset_var('show_htmleditor');
}
$mail_template->set_var('lang_postmode', $LANG03[2]);
$mail_template->set_var('postmode', $postmode);
$mail_template->set_var('start_block_mailstory2friend', COM_startBlock($LANG08[17]));
$mail_template->set_var('lang_fromname', $LANG08[20]);
$mail_template->set_var('name', $from);
$mail_template->set_var('lang_fromemailaddress', $LANG08[21]);
$mail_template->set_var('email', $fromemail);
$mail_template->set_var('lang_toname', $LANG08[18]);
$mail_template->set_var('toname', $to);
$mail_template->set_var('lang_toemailaddress', $LANG08[19]);
$mail_template->set_var('toemail', $toemail);
$mail_template->set_var('lang_shortmessage', $LANG08[27]);
$mail_template->set_var('shortmsg', @htmlspecialchars($shortmsg, ENT_COMPAT, COM_getEncodingt()));
$mail_template->set_var('lang_warning', $LANG08[22]);
$mail_template->set_var('lang_sendmessage', $LANG08[16]);
$mail_template->set_var('story_id', $sid);
PLG_templateSetVars('emailstory', $mail_template);
$mail_template->set_var('end_block', COM_endBlock());
$mail_template->parse('output', 'form');
$retval .= $mail_template->finish($mail_template->get_var('output'));
return $retval;
}
示例9: MG_albumThumbnail
function MG_albumThumbnail($album_id)
{
global $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_MG03;
$sql = "SELECT album_title,album_parent,album_views,enable_album_views," . "media_count,album_desc,album_cover_filename,last_update,tn_attached " . "FROM {$_TABLES['mg_albums']} " . "WHERE album_id=" . intval($album_id);
$result = DB_query($sql);
$album_data = DB_fetchArray($result);
$cover_filename = $album_data['album_cover_filename'];
if ($album_data['media_count'] > 0) {
if ($cover_filename != '' && $cover_filename != '0') {
// Testing!
if (strpos($cover_filename, 'tn_') === 0) {
$tmpfilename = 'tn/' . $cover_filename[3] . '/' . $cover_filename;
} else {
$type = $_MG_CONF['gallery_tn_size'];
// Root album
if ($album_data['album_parent'] > 0) {
$type = DB_getItem($_TABLES['mg_albums'], 'tn_size', 'album_id=' . $album_data['album_parent']);
}
$tmpfilename = 'tn/' . $cover_filename[0] . '/' . $cover_filename;
$tmpfilename = MG_getThumbPath($tmpfilename, $type);
$tmpfilename = rtrim($tmpfilename, '.');
}
list($album_last_image, $mediasize) = MG_getImageUrl($tmpfilename);
$album_last_update = MG_getUserDateTimeFormat($album_data['last_update']);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
}
} else {
$filename = MG_getAlbumCover($album_id);
if ($filename == '' || $filename == NULL || $filename == " ") {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
} else {
list($album_last_image, $mediasize) = MG_getImageUrl('tn/' . $filename[0] . '/' . $filename);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/missing.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
}
$album_media_count = $album_data['media_count'];
if ($album_data['last_update'] > 0) {
$album_last_update = MG_getUserDateTimeFormat($album_data['last_update']);
$lang_updated = $_MG_CONF['dfid'] == '99' ? '' : $LANG_MG03['updated_prompt'];
} else {
$album_last_update[0] = '';
$lang_updated = '';
}
$lang_updated = $_MG_CONF['dfid'] == '99' ? '' : $LANG_MG03['updated_prompt'];
if (isset($_USER['uid']) && $_USER['uid'] > 1) {
$lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '" . $_USER['uid'] . "'");
if ($album_data['last_update'] > $lastlogin) {
$album_last_update[0] = '<span class="mgUpdated">' . $album_last_update[0] . '</span>';
}
}
} else {
// nothing in the album yet...
$filename = MG_getAlbumCover($album_id);
if ($filename == '') {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
} else {
list($album_last_image, $mediasize) = MG_getImageUrl('tn/' . $filename[0] . '/' . $filename);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/missing.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$album_last_update[0] = '';
$lang_updated = '';
}
if ($album_data['tn_attached'] == 1) {
list($album_last_image, $mediasize) = MG_getImageUrl('covers/cover_' . $album_id);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/missing.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$children = MG_getAlbumChildren($album_id);
$subalbums = count($children);
$total_images_subalbums = MG_getMediaCount($album_id);
$parent_album = new mgAlbum($album_data['album_parent']);
$_MG_USERPREFS = MG_getUserPrefs();
if (isset($_MG_USERPREFS['tn_size']) && $_MG_USERPREFS['tn_size'] != -1) {
$tn_size = $_MG_USERPREFS['tn_size'];
} else {
$tn_size = $parent_album->tn_size;
}
list($tn_height, $tn_width) = MG_getTNSize($tn_size, $parent_album->tnHeight, $parent_album->tnWidth);
list($newwidth, $newheight) = MG_getImageWH_3($mediasize[0], $mediasize[1], $tn_width, $tn_height);
$media_item_thumbnail = MG_getFramedImage($parent_album->album_skin, $album_data['album_title'], $_MG_CONF['site_url'] . '/album.php?aid=' . $album_id . '&page=1', $album_last_image, $newwidth, $newheight);
$C = COM_newTemplate(MG_getTemplatePath($album_data['album_parent']));
$C->set_file('cell', 'album_page_album_cell.thtml');
$C->set_var(array('media_item_thumbnail' => $media_item_thumbnail, 'u_viewalbum' => $_MG_CONF['site_url'] . '/album.php?aid=' . $album_id . '&page=1', 'album_last_image' => $album_last_image, 'album_title' => $album_data['album_title'], 'album_media_count' => $album_data['media_count'], 'subalbum_media_count' => $total_images_subalbums, 'album_desc' => PLG_replaceTags($album_data['album_desc']), 'album_last_update' => $album_last_update[0], 'img_height' => $newheight, 'img_width' => $newwidth, 's_media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'row_height' => $tn_height, 'updated' => $lang_updated, 'lang_album' => $LANG_MG00['album'], 'lang_views' => $LANG_MG03['views'], 'views' => $album_data['album_views'], 'lang_views' => $album_data['enable_album_views'] ? $LANG_MG03['views'] : '', 'views' => $album_data['enable_album_views'] ? $album_data['album_views'] : '', 'subalbumcount' => $subalbums > 0 ? '(' . $subalbums . ')' : '', 'lang_subalbums' => $subalbums > 0 ? $LANG_MG01['subalbums'] : ''));
PLG_templateSetVars('mediagallery', $C);
$C->parse('output', 'cell');
$celldisplay = $C->finish($C->get_var('output'));
return $celldisplay;
}
示例10: CMT_commentForm
//.........这里部分代码省略.........
if ($commentuid != $_USER['uid']) {
$uresult = DB_query("SELECT username, fullname FROM {$_TABLES['users']} WHERE uid = {$commentuid}");
list($username, $fullname) = DB_fetchArray($uresult);
} else {
$username = $_USER['username'];
$fullname = $_USER['fullname'];
}
$comment_template->set_var('gltoken_name', CSRF_TOKEN);
$comment_template->set_var('gltoken', SEC_createToken());
$comment_template->set_var('uid', $commentuid);
$name = COM_getDisplayName($commentuid, $username, $fullname);
$comment_template->set_var('username', $name);
$comment_template->set_var('action_url', $_CONF['site_url'] . '/users.php?mode=logout');
$comment_template->set_var('lang_logoutorcreateaccount', $LANG03[03]);
}
$comment_template->set_var('lang_cancel', $LANG_ADMIN['cancel']);
if ($mode == 'editsubmission' or $mode == 'edit' or $mode == $LANG03[34] or $mode == $LANG03[28]) {
$delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
$jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
$comment_template->set_var('delete_option', sprintf($delbutton, $jsconfirm));
$comment_template->set_var('allow_delete', true);
$comment_template->set_var('lang_delete', $LANG_ADMIN['delete']);
$comment_template->set_var('confirm_message', $MESSAGE[76]);
}
if ($mode == 'editsubmission' or $mode == $LANG03[34]) {
// Preview Submission changes (for edit)
$comment_template->set_var('formtype', 'editsubmission');
} elseif ($mode == 'edit' or $mode == $LANG03[28]) {
// Preview changes (for edit)
$comment_template->set_var('formtype', 'edit');
} else {
$comment_template->set_var('formtype', 'new');
}
if ($postmode == 'html') {
$comment_template->set_var('show_texteditor', 'none');
$comment_template->set_var('show_htmleditor', '');
} else {
$comment_template->set_var('show_texteditor', '');
$comment_template->set_var('show_htmleditor', 'none');
}
$comment_template->set_var('lang_title', $LANG03[16]);
$comment_template->set_var('title', htmlspecialchars($title));
$comment_template->set_var('lang_comment', $LANG03[9]);
$comment_template->set_var('comment', $commenttext);
$comment_template->set_var('lang_postmode', $LANG03[2]);
$comment_template->set_var('postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode));
$allowed_html = '';
foreach (array('plaintext', 'html') as $pm) {
$allowed_html .= COM_allowedHTML($permission, false, 1, $pm);
}
$allowed_html .= COM_allowedAutotags();
$comment_template->set_var('allowed_html', $allowed_html);
$comment_template->set_var('lang_importantstuff', $LANG03[18]);
$comment_template->set_var('lang_instr_line1', $LANG03[19]);
$comment_template->set_var('lang_instr_line2', $LANG03[20]);
$comment_template->set_var('lang_instr_line3', $LANG03[21]);
$comment_template->set_var('lang_instr_line4', $LANG03[22]);
$comment_template->set_var('lang_instr_line5', $LANG03[23]);
if ($mode == 'edit' || $mode == $LANG03[28]) {
//editing comment or preview changes
$comment_template->set_var('lang_preview', $LANG03[28]);
} elseif ($mode == 'editsubmission' || $mode == $LANG03[34]) {
$comment_template->set_var('lang_preview', $LANG03[34]);
} else {
//new comment
$comment_template->set_var('lang_preview', $LANG03[14]);
}
if ($mode == $LANG03[28] || $mode == 'edit' && $_CONF['skip_preview'] == 1) {
PLG_templateSetVars('comment', $comment_template);
// Only for a edit form with a save button displayed (CAPTCHA related issue)
// for editing
$comment_template->set_var('save_option', '<input type="submit" name="' . CMT_MODE . '" value="' . $LANG03[29] . '"' . XHTML . '>');
$comment_template->set_var('allow_save', true);
$comment_template->set_var('lang_save', $LANG03[29]);
} elseif ($mode == $LANG03[34] || $mode == 'editsubmission' && $_CONF['skip_preview'] == 1) {
PLG_templateSetVars('comment', $comment_template);
// editing submission comment
$comment_template->set_var('save_option', '<input type="submit" name="' . CMT_MODE . '" value="' . $LANG03[35] . '"' . XHTML . '>');
$comment_template->set_var('allow_save', true);
$comment_template->set_var('lang_save', $LANG03[35]);
} elseif ($_CONF['skip_preview'] == 1 || $mode == $LANG03[14]) {
PLG_templateSetVars('comment', $comment_template);
$comment_template->set_var('save_option', '<input type="submit" name="' . CMT_MODE . '" value="' . $LANG03[11] . '"' . XHTML . '>');
$comment_template->set_var('allow_save', true);
$comment_template->set_var('lang_save', $LANG03[11]);
}
if ($_CONF['allow_reply_notifications'] == 1 && $uid != 1 && ($mode == '' || $mode == $LANG03[14] || $mode == 'error')) {
$checked = '';
if (isset($_POST['notify'])) {
$checked = ' checked="checked"';
}
$comment_template->set_var('notification', '<p><input type="checkbox"' . ' name="notify"' . $checked . '>' . $LANG03[36] . '</p>');
}
$comment_template->set_var('end_block', COM_endBlock());
$comment_template->parse('output', 'form');
$retval .= $comment_template->finish($comment_template->get_var('output'));
}
}
return $retval;
}
示例11: adEdit
/**
* Provide a form to edit a new or existing ad.
* @param array $A Array of ad data for edit form
* @param string $mode Edit mode
* @param boolean $admin True for administrator edit, false for normal
* @return string HTML for ad edit form
*/
function adEdit($A, $mode = 'edit', $admin = false)
{
global $_TABLES, $LANG_ADVT, $_CONF, $_CONF_ADVT, $LANG_ADMIN, $_USER, $LANG_ACCESS, $_GROUPS, $LANG12, $LANG24, $MESSAGE, $LANG_postmodes;
USES_classifieds_class_adtype();
// Determine if this user is an admin. Deprecates the $admin parameter.
$admin = SEC_hasRights($_CONF_ADVT['pi_name'] . '.admin') ? 1 : 0;
// only valid users allowed
if (COM_isAnonUser() || $_CONF_ADVT['usercanedit'] == 0 && !$admin) {
return CLASSIFIEDS_errorMsg($LANG_ADVT['no_permission'], 'alert', $LANG_ADVT['access_denied']);
}
// We know that we need to have categories, so make sure some exist
// before even trying to display the form. The category dropdown is
// created later since it needs the existing cat_id, if any.
if (DB_count($_TABLES['ad_category']) < 1) {
return CLASSIFIEDS_errorMsg($LANG_ADVT['no_categories'], 'info');
}
$time = time();
// used to compare now with expiration date
if ($admin) {
$T = new Template(CLASSIFIEDS_PI_PATH . '/templates/admin');
$T->set_file('adedit', "adminedit.thtml");
$action_url = CLASSIFIEDS_ADMIN_URL . '/index.php';
} else {
$T = new Template(CLASSIFIEDS_PI_PATH . '/templates');
$T->set_file('adedit', "submitform.thtml");
$action_url = CLASSIFIEDS_URL . '/index.php';
}
// Set up the wysiwyg editor, if available
switch (PLG_getEditorType()) {
case 'ckeditor':
$T->set_var('show_htmleditor', true);
PLG_requestEditor('classifieds', 'classifieds_entry', 'ckeditor_classifieds.thtml');
PLG_templateSetVars('classifieds_entry', $T);
break;
case 'tinymce':
$T->set_var('show_htmleditor', true);
PLG_requestEditor('classifieds', 'classifieds_entry', 'tinymce_classifieds.thtml');
PLG_templateSetVars('classifieds_entry', $T);
break;
default:
// don't support others right now
$T->set_var('show_htmleditor', false);
break;
}
switch ($mode) {
case 'editsubmission':
case 'moderate':
$savemode = 'savesubmission';
$delete_img = 'delsubimg';
$delete_ad = 'deletesubmission';
$type = 'moderate';
$saveoption = $LANG_ADMIN['moderate'];
$cancel_url = $_CONF['site_admin_url'] . '/moderation.php';
break;
case 'edit':
$savemode = 'savesubmission';
$delete_img = 'delsubimg';
$delete_ad = 'deletesubmission';
$saveoption = $LANG_ADMIN['save'];
$type = 'submission';
$cancel_url = $action_url;
break;
case 'update_ad':
default:
$savemode = 'update_ad';
$delete_img = 'delete_img';
$delete_ad = 'delete_ad';
$saveoption = $LANG_ADMIN['save'];
$type = '';
$cancel_url = $action_url;
break;
}
// Admins (only) use this form for submissions as well as edits,
// so we need to expect an empty array.
if (empty($A['ad_id'])) {
if (!$admin) {
return CLASSIFIEDS_errorMsg($LANG_ADVT['no_permission'], 'alert', $LANG_ADVT['access_denied']);
}
$A['ad_id'] = COM_makeSid();
$A['subject'] = '';
$A['descript'] = '';
$A['price'] = '';
$A['url'] = '';
$A['exp_date'] = '';
$A['add_date'] = time();
$A['ad_type'] = 0;
$A['perm_owner'] = $_CONF_ADVT['default_permissions'][0];
$A['perm_group'] = $_CONF_ADVT['default_permissions'][1];
$A['perm_members'] = $_CONF_ADVT['default_permissions'][2];
$A['perm_anon'] = $_CONF_ADVT['default_permissions'][3];
$A['uid'] = $_USER['uid'];
if (isset($_REQUEST['cat'])) {
$A['cat_id'] = intval($_REQUEST['cat']);
//.........这里部分代码省略.........
示例12: newuserform
/**
* Shows the user registration form
*
* @param int $msg message number to show
* @param string $referrer page to send user to after registration
* @return string HTML for user registration page
*/
function newuserform($msg = '')
{
global $_CONF, $LANG04;
$retval = '';
if (!empty($msg)) {
$retval .= COM_showMessageText($msg, $LANG04[21]);
}
$user_templates = COM_newTemplate($_CONF['path_layout'] . 'users');
$user_templates->set_file('regform', 'registrationform.thtml');
$user_templates->set_var('start_block', COM_startBlock($LANG04[22]));
$user_templates->set_var('lang_instructions', $LANG04[23]);
$user_templates->set_var('lang_username', $LANG04[2]);
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('lang_email_conf', $LANG04[124]);
$user_templates->set_var('lang_warning', $LANG04[24]);
$user_templates->set_var('lang_register', $LANG04[27]);
PLG_templateSetVars('registration', $user_templates);
$user_templates->set_var('end_block', COM_endBlock());
$username = '';
if (!empty($_POST['username'])) {
$username = COM_applyFilter($_POST['username']);
}
$user_templates->set_var('username', $username);
$email = '';
if (!empty($_POST['email'])) {
$email = COM_applyFilter($_POST['email']);
}
$user_templates->set_var('email', $email);
$email_conf = '';
if (!empty($_POST['email_conf'])) {
$email_conf = COM_applyFilter($_POST['email_conf']);
}
$user_templates->set_var('email_conf', $email_conf);
$user_templates->parse('output', 'regform');
$retval .= $user_templates->finish($user_templates->get_var('output'));
return $retval;
}
示例13: submitstory
/**
* Shows the story submission form
*
*/
function submitstory($topic = '')
{
global $_CONF, $_TABLES, $_USER, $LANG12, $LANG24, $REMOTE_ADDR;
$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();
$retval .= '<div style="border-bottom:1px solid #cccccc"></div>';
} else {
$story->initSubmission($topic);
$story->loadSubmission();
}
if ($_CONF['story_submit_by_perm_only']) {
$topicList = COM_topicList('tid,topic', $story->EditElements('tid'), 1, false, 3);
} else {
$topicList = COM_topicList('tid,topic', $story->EditElements('tid'));
}
// no topics
if ($topicList == '') {
$retval = COM_showMessageText($LANG24[66], '', 1, 'error');
return $retval;
}
$retval .= COM_startBlock($LANG12[6]);
$storyform = new Template($_CONF['path_layout'] . 'submit');
$storyform->set_file('storyform', 'submitstory.thtml');
if ($story->EditElements('postmode') == 'html') {
$storyform->set_var('show_htmleditor', true);
} else {
$storyform->unset_var('show_htmleditor');
}
$storyform->set_var('site_admin_url', $_CONF['site_admin_url']);
$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]);
$storyform->set_var('story_topic_options', $topicList);
/*
if ( $_CONF['story_submit_by_perm_only'] ) {
$storyform->set_var('story_topic_options', COM_topicList('tid,topic',$story->EditElements('tid'),1,false,3));
} else {
$storyform->set_var('story_topic_options', COM_topicList('tid,topic',$story->EditElements('tid')));
}
*/
$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]);
$storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $story->EditElements('postmode')));
$storyform->set_var('postmode', $story->EditElements('postmode'));
$storyform->set_var('allowed_html', COM_allowedHTML(SEC_getUserPermissions(), false, 'glfusion', 'story') . '<br/>' . COM_allowedAutotags(SEC_getUserPermissions(), false, 'glfusion', 'story'));
$storyform->set_var('story_uid', $story->EditElements('uid'));
$storyform->set_var('story_sid', $story->EditElements('sid'));
$storyform->set_var('story_date', $story->EditElements('unixdate'));
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 . '>');
}
$storyform->set_var('lang_preview', $LANG12[32]);
$storyform->parse('theform', 'storyform');
$retval .= $storyform->finish($storyform->get_var('theform'));
$retval .= COM_endBlock();
$urlfor = 'advancededitor';
if (COM_isAnonUser()) {
$urlfor = 'advancededitor' . md5($REMOTE_ADDR);
}
$rc = @setcookie($_CONF['cookie_name'] . 'adveditor', SEC_createTokenGeneral($urlfor), time() + 1200, $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
return $retval;
}
示例14: mailstoryform
/**
* Display form to email a story to someone.
*
* @param string $sid ID of article to email
* @param bool $cc Whether to send a copy of the message to the author
* @param string $to name of person / friend to email
* @param string $toemail friend's email address
* @param string $from name of person sending the email
* @param string $fromemail sender's email address
* @param string $shortmsg short intro text to send with the story
* @param string $msg Error message code
* @return string HTML for email story form
*
*/
function mailstoryform($sid, $cc = false, $to = '', $toemail = '', $from = '', $fromemail = '', $shortmsg = '', $msg = 0)
{
global $_CONF, $_TABLES, $_USER, $LANG08;
require_once $_CONF['path_system'] . 'lib-story.php';
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
return $retval;
}
$story = new Story();
$result = $story->loadFromDatabase($sid, 'view');
if ($result != STORY_LOADED_OK) {
COM_redirect($_CONF['site_url'] . '/index.php');
}
if ($msg > 0) {
$retval .= COM_showMessage($msg);
}
if (empty($from) && empty($fromemail)) {
if (!COM_isAnonUser()) {
$from = COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname']);
$fromemail = DB_getItem($_TABLES['users'], 'email', "uid = {$_USER['uid']}");
}
}
$cc = $cc ? ' checked="checked"' : '';
$mail_template = COM_newTemplate($_CONF['path_layout'] . 'profiles');
$mail_template->set_file('form', 'contactauthorform.thtml');
$mail_template->set_var('start_block_mailstory2friend', COM_startBlock($LANG08[17]));
$mail_template->set_var('lang_title', $LANG08[31]);
$mail_template->set_var('story_title', $story->displayElements('title'));
$url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
$mail_template->set_var('story_url', $url);
$link = COM_createLink($story->displayElements('title'), $url);
$mail_template->set_var('story_link', $link);
$mail_template->set_var('lang_fromname', $LANG08[20]);
$mail_template->set_var('name', $from);
$mail_template->set_var('lang_fromemailaddress', $LANG08[21]);
$mail_template->set_var('email', $fromemail);
$mail_template->set_var('lang_toname', $LANG08[18]);
$mail_template->set_var('toname', $to);
$mail_template->set_var('lang_toemailaddress', $LANG08[19]);
$mail_template->set_var('toemail', $toemail);
if (!$_CONF['mail_cc_enabled']) {
$mail_template->set_var('cc_enabled', ' style="display: none"');
} else {
$mail_template->set_var('cc', $cc);
$mail_template->set_var('lang_cc', $LANG08[36]);
$mail_template->set_var('lang_cc_description', $LANG08[37]);
}
$mail_template->set_var('lang_shortmessage', $LANG08[27]);
$mail_template->set_var('shortmsg', htmlspecialchars($shortmsg));
$mail_template->set_var('lang_warning', $LANG08[22]);
$mail_template->set_var('lang_sendmessage', $LANG08[16]);
$mail_template->set_var('story_id', $sid);
$mail_template->set_var('end_block', COM_endBlock());
PLG_templateSetVars('emailstory', $mail_template);
$mail_template->parse('output', 'form');
$retval .= $mail_template->finish($mail_template->get_var('output'));
return $retval;
}
示例15: albumThumbnail
//.........这里部分代码省略.........
}
}
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/placeholder.svg';
$mediasize = array($this->tnWidth, $this->tnHeight);
// @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$album_last_update[0] = '';
$lang_updated = '';
}
if ($this->tn_attached == 1) {
$mediasize = false;
foreach ($_MG_CONF['validExtensions'] as $ext) {
if (file_exists($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $this->id . $ext)) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/covers/cover_' . $this->id . $ext;
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $this->id . $ext);
break;
}
}
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/placeholder.svg';
$mediasize = array($this->tnWidth, $this->tnHeight);
//@getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$subalbums = count($this->children);
$total_images_subalbums = $this->getMediaCount();
if (isset($_MG_USERPREFS['tn_size']) && $_MG_USERPREFS['tn_size'] != -1) {
$tn_size = $_MG_USERPREFS['tn_size'];
} else {
$tn_size = $MG_albums[$this->parent]->tn_size;
}
switch ($tn_size) {
case '0':
//small
$tn_height = 100;
$tn_width = 100;
break;
case '1':
//medium
$tn_height = 150;
$tn_width = 150;
break;
case '2':
$tn_height = 200;
$tn_width = 200;
break;
case '3':
case '4':
$tn_height = $MG_albums[$this->parent]->tnHeight;
$tn_width = $MG_albums[$this->parent]->tnWidth;
if ($tn_height == 0) {
$tn_height = 200;
}
if ($tn_width == 0) {
$tn_width = 200;
}
break;
default:
$tn_height = 200;
$tn_width = 200;
break;
}
if ($mediasize[0] > $mediasize[1]) {
$ratio = $mediasize[0] / $tn_height;
$newwidth = $tn_height;
$newheight = round($mediasize[1] / $ratio);
} else {
$ratio = $mediasize[1] / $tn_height;
$newheight = $tn_height;
$newwidth = round($mediasize[0] / $ratio);
}
$F = new Template($_MG_CONF['template_path']);
$F->set_var('media_frame', $MG_albums[$this->parent]->albumFrameTemplate);
$F->set_var(array('border_width' => $newwidth + 20, 'border_height' => $newheight + 20, 'media_link_start' => '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&page=1' . '">', 'media_link_end' => '</a>', 'url_media_item' => $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&page=1', 'media_thumbnail' => $album_last_image, 'media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'media_height' => $newheight, 'media_width' => $newwidth, 'media_tag' => $this->title, 'frWidth' => $newwidth - $MG_albums[$this->parent]->afrWidth, 'frHeight' => $newheight - $MG_albums[$this->parent]->afrHeight));
$F->parse('media', 'media_frame');
$media_item_thumbnail = $F->finish($F->get_var('media'));
$C = new Template(MG_getTemplatePath($this->parent));
if ($this->parent != 0 && $MG_albums[$this->parent]->display_columns == 1) {
$C->set_file('cell', 'album_page_body_album_cell_1.thtml');
} else {
$C->set_file('cell', 'album_page_body_album_cell.thtml');
}
$C->set_var(array('media_item_thumbnail' => $media_item_thumbnail, 'media_item_thumbnail_raw' => $album_last_image, 'u_viewalbum' => $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&page=1', 'album_last_image' => $album_last_image, 'album_title' => $this->title, 'album_media_count' => $this->media_count, 'subalbum_media_count' => $total_images_subalbums, 'album_desc' => PLG_replaceTags($this->description, 'mediagallery', 'album_description'), 'album_last_update' => $album_last_update[0], 'img_height' => $newheight, 'img_width' => $newwidth, 's_media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'border_width' => $newwidth + 20, 'border_height' => $newheight + 20, 'row_height' => $tn_height + 40, 'updated' => $lang_updated, 'lang_album' => $LANG_MG00['album'], 'lang_views' => $LANG_MG03['views'], 'views' => $this->views));
if ($this->enable_album_views) {
$C->set_var(array('lang_views' => $LANG_MG03['views'], 'views' => $this->views));
} else {
$C->set_var(array('lang_views' => '', 'views' => ''));
}
if ($subalbums > 0) {
$C->set_var(array('subalbumcount' => '(' . $subalbums . ')', 'lang_subalbums' => $LANG_MG01['subalbums']));
} else {
$C->set_var(array('subalbumcount' => '', 'lang_subalbums' => ''));
}
PLG_templateSetVars('mediagallery', $C);
$C->parse('output', 'cell');
$celldisplay = $C->finish($C->get_var('output'));
return $celldisplay;
}