本文整理汇总了PHP中COM_getDisplayName函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_getDisplayName函数的具体用法?PHP COM_getDisplayName怎么用?PHP COM_getDisplayName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_getDisplayName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adduserevent
/**
* Adds an event to the user's calendar
*
* The user has asked that an event be added to their personal
* calendar. Show a confirmation screen.
*
* @param string $eid event ID to add to user's calendar
* @return string HTML for confirmation form
*
*/
function adduserevent($eid)
{
global $_CONF, $_TABLES, $LANG_CALJP_1;
$retval = '';
$eventsql = "SELECT * FROM {$_TABLES['eventsjp']} WHERE eid='{$eid}'" . COM_getPermSql('AND');
$result = DB_query($eventsql);
$nrows = DB_numRows($result);
if ($nrows == 1) {
$retval .= COM_startBlock(sprintf($LANG_CALJP_1[11], COM_getDisplayName()));
$A = DB_fetchArray($result);
$cal_template = COM_newTemplate($_CONF['path'] . 'plugins/calendarjp/templates/');
$cal_template->set_file(array('addevent' => 'addevent.thtml'));
$cal_template->set_var('intro_msg', $LANG_CALJP_1[8]);
$cal_template->set_var('lang_event', $LANG_CALJP_1[12]);
$event_title = stripslashes($A['title']);
if (!empty($A['url']) && $A['url'] != 'http://') {
$event_title_and_url = COM_createLink($event_title, $A['url'], array('class' => 'url'));
$cal_template->set_var('event_url', $A['url']);
$cal_template->set_var('event_begin_anchortag', '<a href="' . $A['url'] . '" class="url">');
$cal_template->set_var('event_end_anchortag', '</a>');
} else {
$event_title_and_url = $event_title;
$cal_template->set_var('event_url', '');
$cal_template->set_var('event_begin_anchortag', '');
$cal_template->set_var('event_end_anchortag', '');
}
$cal_template->set_var('event_title', $event_title_and_url);
$cal_template->set_var('event_title_only', $event_title);
$cal_template->set_var('lang_starts', $LANG_CALJP_1[13]);
$cal_template->set_var('lang_ends', $LANG_CALJP_1[14]);
$thestart = COM_getUserDateTimeFormat($A['datestart'] . ' ' . $A['timestart']);
$theend = COM_getUserDateTimeFormat($A['dateend'] . ' ' . $A['timeend']);
if ($A['allday'] == 0) {
$cal_template->set_var('event_start', $thestart[0]);
$cal_template->set_var('event_end', $theend[0]);
} else {
$cal_template->set_var('event_start', strftime($_CONF['shortdate'], $thestart[1]));
$cal_template->set_var('event_end', strftime($_CONF['shortdate'], $theend[1]));
}
$cal_template->set_var('lang_where', $LANG_CALJP_1[4]);
$location = stripslashes($A['location']) . '<br' . XHTML . '>' . stripslashes($A['address1']) . '<br' . XHTML . '>' . stripslashes($A['address2']) . '<br' . XHTML . '>' . stripslashes($A['city']) . ', ' . stripslashes($A['state']) . ' ' . $A['zipcode'];
$cal_template->set_var('event_location', $location);
$cal_template->set_var('lang_description', $LANG_CALJP_1[5]);
$description = stripslashes($A['description']);
if (empty($A['postmode']) || $A['postmode'] == 'plaintext') {
$description = COM_nl2br($description);
}
$cal_template->set_var('event_description', PLG_replaceTags($description));
$cal_template->set_var('event_id', $eid);
$cal_template->set_var('lang_addtomycalendar', $LANG_CALJP_1[9]);
$cal_template->set_var('gltoken_name', CSRF_TOKEN);
$cal_template->set_var('gltoken', SEC_createToken());
$cal_template->parse('output', 'addevent');
$retval .= $cal_template->finish($cal_template->get_var('output'));
$retval .= COM_endBlock();
} else {
$retval .= COM_showMessage(23);
}
return $retval;
}
示例2: MG_buildSearchBox
function MG_buildSearchBox(&$T, $searchinfo = array())
{
global $_CONF, $_MG_CONF, $_TABLES, $LANG_MG01, $LANG_MG03;
$cat_select = '<select name="cat_id">';
$select_cat_id = $searchinfo['cat_id'] == '' ? UC_SELECTED : '';
$cat_select .= '<option value="" ' . $select_cat_id . '>' . $LANG_MG03['all_categories'] . '</option>';
$result = DB_query("SELECT cat_id, cat_name FROM {$_TABLES['mg_category']} ORDER BY cat_id ASC");
while ($row = DB_fetchArray($result)) {
$select_cat_id = $searchinfo['cat_id'] == $row['cat_id'] ? UC_SELECTED : '';
$cat_select .= '<option value="' . $row['cat_id'] . '" ' . $select_cat_id . '>' . $row['cat_name'] . '</option>';
}
$cat_select .= '</select>';
$keytype = MG_optionlist(array('name' => 'keyType', 'current' => $searchinfo['keytype'], 'values' => array('phrase' => $LANG_MG03['exact_phrase'], 'all' => $LANG_MG03['all'], 'any' => $LANG_MG03['any'])));
$swhere = MG_optionlist(array('name' => 'swhere', 'current' => $searchinfo['swhere'], 'values' => array('0' => $LANG_MG03['title_desc_keywords'], '1' => $LANG_MG03['keywords_only'], '2' => $LANG_MG03['title_desc_only'], '3' => $LANG_MG01['artist'], '4' => $LANG_MG01['music_album'], '5' => $LANG_MG01['genre'])));
$nresults = MG_optionlist(array('name' => 'numresults', 'current' => $searchinfo['numresults'], 'values' => array('10' => '10', '20' => '20', '30' => '30', '40' => '40', '50' => '50')));
$userselect = '<select name="uid">';
$select_uid = $searchinfo['uid'] == '0' ? UC_SELECTED : '';
$userselect .= '<option value="0" ' . $select_uid . '>' . $LANG_MG01['all_users'] . '</option>';
$result = DB_query("SELECT uid FROM {$_TABLES['users']} WHERE uid > 1 ORDER BY username");
while ($U = DB_fetchArray($result)) {
$select_uid = $searchinfo['uid'] == $U['uid'] ? UC_SELECTED : '';
$userselect .= '<option value="' . $U['uid'] . '" ' . $select_uid . '>' . COM_getDisplayName($U['uid']) . '</option>';
}
$userselect .= '</select>';
$T->set_var(array('s_form_action' => $_MG_CONF['site_url'] . '/search.php', 'mode' => 'search', 'action' => '', 'cat_select' => $cat_select, 'keytype_select' => $keytype, 'swhere_select' => $swhere, 'nresults_select' => $nresults, 'user_select' => $userselect, 'lang_search_title' => $LANG_MG03['advanced_search'], 'lang_search_query' => $LANG_MG03['search_query'], 'lang_search_help' => $LANG_MG03['search_help'], 'lang_options' => $LANG_MG03['options'], 'lang_keywords' => $LANG_MG03['keywords'], 'lang_category' => $LANG_MG03['category'], 'lang_all_fields' => $LANG_MG03['all_fields'], 'lang_keyword_only' => $LANG_MG03['keywords_only'], 'lang_return_results' => $LANG_MG03['return_results'], 'lang_search_for' => $LANG_MG03['search_for'], 'lang_search_in' => $LANG_MG03['search_in'], 'lang_results' => $LANG_MG03['results'], 'lang_per_page' => $LANG_MG03['per_page'], 'lang_search' => $LANG_MG01['search'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_user' => $LANG_MG01['select_user']));
}
示例3: MG_displaySearchBox
function MG_displaySearchBox($msg = '')
{
global $_CONF, $_MG_CONF, $_TABLES, $LANG_MG01, $LANG_MG03;
$retval = '';
$T = new Template(MG_getTemplatePath(0));
$T->set_file('search', 'search.thtml');
$cat_select = '<select name="cat_id">';
$cat_select .= '<option value="">' . $LANG_MG03['all_categories'] . '</option>';
$result = DB_query("SELECT * FROM {$_TABLES['mg_category']} ORDER BY cat_id ASC");
$nRows = DB_numRows($result);
for ($i = 0; $i < $nRows; $i++) {
$row = DB_fetchArray($result);
$cat_select .= '<option value="' . $row['cat_id'] . '">' . $row['cat_name'] . '</option>';
}
$cat_select .= '</select>';
$keytype = '<select name="keyType">';
$keytype .= '<option value="phrase">' . $LANG_MG03['exact_phrase'] . '</option>';
$keytype .= '<option value="all">' . $LANG_MG03['all'] . '</option>';
$keytype .= '<option value="any">' . $LANG_MG03['any'] . '</option>';
$keytype .= '</select>';
$swhere = '<select name="swhere">';
$swhere .= '<option value="0">' . $LANG_MG03['title_desc_keywords'] . '</option>';
$swhere .= '<option value="1">' . $LANG_MG03['keywords_only'] . '</option>';
$swhere .= '<option value="2">' . $LANG_MG03['title_desc_only'] . '</option>';
$swhere .= '<option value="3">' . $LANG_MG01['artist'] . '</option>';
$swhere .= '<option value="4">' . $LANG_MG01['music_album'] . '</option>';
$swhere .= '<option value="5">' . $LANG_MG01['genre'] . '</option>';
$swhere .= '</select>';
$nresults = '<select name="numresults">';
$nresults .= '<option value="10">10</option>';
$nresults .= '<option value="20">20</option>';
$nresults .= '<option value="30">30</option>';
$nresults .= '<option value="40">40</option>';
$nresults .= '<option value="50">50</option>';
$nresults .= '</select>';
$userselect = '<select name="uid">';
$userselect .= '<option value="0">' . $LANG_MG01['all_users'] . '</option>';
$sql = "SELECT uid,username,fullname FROM {$_TABLES['users']} WHERE uid > 1 ORDER BY username";
$result = DB_query($sql);
while ($U = DB_fetchArray($result)) {
$userselect .= '<option value="' . $U['uid'] . '">' . COM_getDisplayName($U['uid']) . '</option>' . LB;
}
$userselect .= '</select>';
$T->set_var(array('msg' => $msg, 's_form_action' => $_MG_CONF['site_url'] . '/search.php', 'mode' => 'search', 'action' => '', 'cat_select' => $cat_select, 'keytype_select' => $keytype, 'swhere_select' => $swhere, 'nresults_select' => $nresults, 'user_select' => $userselect, 'lang_search_title' => $LANG_MG03['advanced_search'], 'lang_search_query' => $LANG_MG03['search_query'], 'lang_search_help' => $LANG_MG03['search_help'], 'lang_options' => $LANG_MG03['options'], 'lang_keywords' => $LANG_MG03['keywords'], 'lang_category' => $LANG_MG03['category'], 'lang_all_fields' => $LANG_MG03['all_fields'], 'lang_keyword_only' => $LANG_MG03['keywords_only'], 'lang_return_results' => $LANG_MG03['return_results'], 'lang_search_for' => $LANG_MG03['search_for'], 'lang_search_in' => $LANG_MG03['search_in'], 'lang_results' => $LANG_MG03['results'], 'lang_per_page' => $LANG_MG03['per_page'], 'lang_search' => $LANG_MG01['search'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_user' => $LANG_MG01['select_user']));
$T->parse('output', 'search');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例4: trim
$report->set_var('pm_link', '');
}
if ($siteMembers['homepage'] != '') {
$homepage = trim($siteMembers['homepage']);
if (strtolower(substr($homepage, 0, 4)) != 'http') {
$homepage = 'http://' . $homepage;
}
$report->set_var('link_url', $homepage);
$report->set_var('link_text', $LANG_GF09['home']);
$report->parse('website_link', 'link');
} else {
$report->set_var('website_link', '');
}
$regdate = explode(" ", $siteMembers['regdate']);
$report->set_var('member_uid', $siteMembers['uid']);
$report->set_var('member_name', COM_getDisplayName($siteMembers['uid']));
$report->set_var('csscode', $csscode);
$report->set_var('member_regdate', $regdate[0]);
$report->set_var('member_numposts', $siteMembers['posts']);
$report->set_var('member_uid', $siteMembers['uid']);
$report->parse('report_records', 'records', true);
if ($csscode == 2) {
$csscode = 1;
} else {
$csscode++;
}
}
$report->set_var('pagenavigation', COM_printPageNavigation($base_url, $page, $numpages));
$report->parse('output', 'report');
$display .= $report->finish($report->get_var('output'));
}
示例5: storyeditor
//.........这里部分代码省略.........
$navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",4);return false;', true);
$navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",5);return false;', true);
$navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",6);return false;', true);
} else {
$navbar->add_menuitem($LANG24[80], 'showhideEditorDiv("editor",0);return false;', true);
$navbar->add_menuitem($LANG24[81], 'showhideEditorDiv("publish",1);return false;', true);
$navbar->add_menuitem($LANG24[82], 'showhideEditorDiv("images",2);return false;', true);
$navbar->add_menuitem($LANG24[83], 'showhideEditorDiv("archive",3);return false;', true);
$navbar->add_menuitem($LANG24[84], 'showhideEditorDiv("perms",4);return false;', true);
$navbar->add_menuitem($LANG24[85], 'showhideEditorDiv("all",5);return false;', true);
}
if ($mode == 'preview') {
$story_templates->set_var('show_preview', '');
$story_templates->set_var('show_htmleditor', 'none');
$story_templates->set_var('show_texteditor', 'none');
$story_templates->set_var('show_submitoptions', 'none');
$navbar->set_selected($LANG24[79]);
} else {
$navbar->set_selected($LANG24[80]);
}
$story_templates->set_var('navbar', $navbar->generate());
}
$oldsid = $story->EditElements('originalSid');
if (!empty($oldsid) && $mode != 'clone') {
$delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s' . XHTML . '>';
$jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
$story_templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
$story_templates->set_var('delete_option_no_confirmation', sprintf($delbutton, ''));
}
if ($mode == 'editsubmission' || $story->type == 'submission') {
$story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission"' . XHTML . '>');
}
$story_templates->set_var('lang_author', $LANG24[7]);
$storyauthor = COM_getDisplayName($story->EditElements('uid'));
$story_templates->set_var('story_author', $storyauthor);
$story_templates->set_var('author', $storyauthor);
$story_templates->set_var('story_uid', $story->EditElements('uid'));
// user access info
$story_templates->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
$story_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
$ownername = COM_getDisplayName($story->EditElements('owner_id'));
$story_templates->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', 'uid = ' . $story->EditElements('owner_id')));
$story_templates->set_var('owner_name', $ownername);
$story_templates->set_var('owner', $ownername);
$story_templates->set_var('owner_id', $story->EditElements('owner_id'));
$story_templates->set_var('lang_group', $LANG_ACCESS['group']);
$story_templates->set_var('group_dropdown', SEC_getGroupDropdown($story->EditElements('group_id'), 3));
$story_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
$story_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
$story_templates->set_var('permissions_editor', SEC_getPermissionsHTML($story->EditElements('perm_owner'), $story->EditElements('perm_group'), $story->EditElements('perm_members'), $story->EditElements('perm_anon')));
$story_templates->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
$story_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
$curtime = COM_getUserDateTimeFormat($story->EditElements('date'));
$story_templates->set_var('lang_date', $LANG24[15]);
$story_templates->set_var('publish_second', $story->EditElements('publish_second'));
$publish_ampm = '';
$publish_hour = $story->EditElements('publish_hour');
if ($publish_hour >= 12) {
if ($publish_hour > 12) {
$publish_hour = $publish_hour - 12;
}
$ampm = 'pm';
} else {
$ampm = 'am';
}
$ampm_select = COM_getAmPmFormSelection('publish_ampm', $ampm);
示例6: Notify
/**
* Send an email to the buyer
*
* @param string $status Order status (pending, paid, etc.)
* @param string $msg Optional message to include with email
*/
public function Notify($status = '', $gw_msg = '')
{
global $_CONF, $_PP_CONF, $_TABLES;
// Check if we're supposed to send a notification
if ($this->uid != 1 && $_PP_CONF['purch_email_user'] || $this->uid == 1 && $_PP_CONF['purch_email_anon']) {
PAYPAL_debug("Sending email to " . $this->uid);
// setup templates
$message = new Template(PAYPAL_PI_PATH . '/templates');
$message->set_file(array('subject' => 'purchase_email_subject.txt', 'msg_admin' => 'purchase_email_admin.txt', 'msg_user' => 'purchase_email_user.txt', 'msg_body' => 'purchase_email_body.txt'));
// Add all the items to the message
$total = (double) 0;
// Track total purchase value
$files = array();
// Array of filenames, for attachments
$num_format = "%5.2f";
$item_total = 0;
$have_physical = 0;
// Assume no physical items.
$dl_links = '';
// Start with empty download links
USES_paypal_class_product();
foreach ($this->items as $id => $item) {
if (!PAYPAL_is_plugin_item($item['product_id'])) {
$P = new Product($item['product_id']);
if ($P->prod_type & PP_PROD_PHYSICAL == PP_PROD_PHYSICAL) {
$have_physical = 1;
}
// Add the file to the filename array, if any. Download
// links are only included if the order status is 'paid'
$file = $P->file;
if (!empty($file) && $this->status == 'paid') {
$files[] = $file;
$dl_url = PAYPAL_URL . '/download.php?';
// There should always be a token, but fall back to the
// product ID if there isn't
if (!empty($item['token'])) {
$dl_url .= 'token=' . urlencode($item['token']);
} else {
$dl_url .= 'id=' . $item['item_number'];
}
$dl_links .= "<a href=\"{$dl_url}\">{$dl_url}</a><br />";
}
}
$ext = (double) $item['quantity'] * (double) $item['price'];
$item_total += $ext;
$item_descr = isset($item['description']) ? $item['description'] : $item['descrip'];
//$message->set_block('message', 'ItemList', 'List');
$opts = json_decode($item['options_text'], true);
if ($opts) {
foreach ($opts as $opt_text) {
$options_text .= " -- {$opt_text}<br />";
}
}
$message->set_block('msg_body', 'ItemList', 'List');
$message->set_var(array('qty' => $item['quantity'], 'price' => sprintf($num_format, $item['price']), 'ext' => sprintf($num_format, $ext), 'name' => $item_descr, 'options_text' => $options_text));
//PAYPAL_debug("Qty: {$item['quantity']} : Amount: {$item['price']} : Name: {$item['name']}", 'debug_ipn');
$message->parse('List', 'ItemList', true);
}
// Determine if files will be attached to this message based on
// global config and whether there are actually any files to
// attach. Affects the 'files' flag in the email template and
// which email function is used.
if ((is_numeric($this->uid) && $this->uid != 1 && $_PP_CONF['purch_email_user_attach'] || (!is_numeric($this->uid) || $this->uid == 1) && $_PP_CONF['purch_email_anon_attach']) && count($files) > 0) {
$do_send_attachments = true;
} else {
$do_send_attachments = false;
}
$total_amount = $item_total + $this->tax + $this->shipping + $this->handling;
$user_name = COM_getDisplayName($this->uid);
if ($this->billto_name == '') {
$this->billto_name = $user_name;
}
$message->set_var(array('payment_gross' => sprintf($num_format, $total_amount), 'payment_items' => sprintf($num_format, $item_total), 'tax' => sprintf($num_format, $this->tax), 'shipping' => sprintf($num_format, $this->shipping), 'handling' => sprintf($num_format, $this->handling), 'payment_date' => $_PP_CONF['now']->toMySQL(true), 'payer_email' => $this->buyer_email, 'payer_name' => $this->billto_name, 'site_name' => $_CONF['site_name'], 'txn_id' => $this->pmt_txn_id, 'pi_url' => PAYPAL_URL, 'pi_admin_url' => PAYPAL_ADMIN_URL, 'dl_links' => $dl_links, 'files' => $do_send_attachments ? 'true' : '', 'buyer_uid' => $this->uid, 'user_name' => $user_name, 'gateway_name' => $this->pmt_method, 'pending' => $this->status == 'pending' ? 'true' : '', 'gw_msg' => $gw_msg, 'status' => $this->status, 'order_instr' => $this->instructions));
// parse templates for subject/text
$subject = trim($message->parse('output', 'subject'));
$message->set_var('purchase_details', $message->parse('detail', 'msg_body'));
$user_text = $message->parse('user_out', 'msg_user');
$admin_text = $message->parse('admin_out', 'msg_admin');
if ($this->buyer_email != '') {
// if specified to mail attachment, do so, otherwise skip
// attachment
if ($do_send_attachments) {
// Make sure plugin functions are available
USES_paypal_functions();
PAYPAL_mailAttachment($this->buyer_email, $subject, $user_text, $_CONF['site_email'], true, 0, '', '', $files);
} else {
// Otherwise send a standard notification
COM_emailNotification(array('to' => array($this->buyer_email), 'from' => $_CONF['site_mail'], 'htmlmessage' => $user_text, 'subject' => $subject));
}
}
// Send a notification to the administrator, new purchases only
if ($status == '') {
if ($_PP_CONF['purch_email_admin'] == 2 || $have_physical && $_PP_CONF['purch_email_admin'] == 1) {
PAYPAL_debug('Sending email to Admin');
//.........这里部分代码省略.........
示例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: batchreminders
/**
* This function used to send out reminders to users to access the site or account may be deleted
*
* @return string HTML with success or error message
*
*/
function batchreminders()
{
global $_CONF, $_TABLES, $LANG04, $LANG28;
$msg = '';
$user_list = array();
if (isset($_POST['delitem'])) {
$user_list = $_POST['delitem'];
}
if (count($user_list) == 0) {
$msg = $LANG28[79] . '<br' . XHTML . '>';
}
$c = 0;
if (isset($_POST['delitem']) and is_array($_POST['delitem'])) {
foreach ($_POST['delitem'] as $delitem) {
$userid = COM_applyFilter($delitem);
$useremail = DB_getItem($_TABLES['users'], 'email', "uid = '{$userid}'");
$username = DB_getItem($_TABLES['users'], 'username', "uid = '{$userid}'");
$lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '{$userid}'");
$lasttime = COM_getUserDateTimeFormat($lastlogin);
if (file_exists($_CONF['path_data'] . 'reminder_email.txt')) {
$template = COM_newTemplate($_CONF['path_data']);
$template->set_file(array('mail' => 'reminder_email.txt'));
$template->set_var('site_name', $_CONF['site_name']);
$template->set_var('site_slogan', $_CONF['site_slogan']);
$template->set_var('lang_username', $LANG04[2]);
$template->set_var('username', $username);
$template->set_var('name', COM_getDisplayName($uid));
$template->set_var('lastlogin', $lasttime[0]);
$template->parse('output', 'mail');
$mailtext = $template->finish($template->get_var('output'));
} else {
if ($lastlogin == 0) {
$mailtext = $LANG28[83] . "\n\n";
} else {
$mailtext = sprintf($LANG28[82], $lasttime[0]) . "\n\n";
}
$mailtext .= sprintf($LANG28[84], $username) . "\n";
$mailtext .= sprintf($LANG28[85], $_CONF['site_url'] . '/users.php?mode=getpassword') . "\n\n";
}
$subject = sprintf($LANG28[81], $_CONF['site_name']);
if ($_CONF['site_mail'] !== $_CONF['noreply_mail']) {
$mailfrom = $_CONF['noreply_mail'];
$mailtext .= LB . LB . $LANG04[159];
} else {
$mailfrom = $_CONF['site_mail'];
}
if (COM_mail($useremail, $subject, $mailtext, $mailfrom)) {
DB_query("UPDATE {$_TABLES['users']} SET num_reminders=num_reminders+1 WHERE uid={$userid}");
$c++;
} else {
COM_errorLog("Error attempting to send account reminder to use:{$username} ({$userid})");
}
}
}
// Since this function is used for deletion only, its necessary to say that
// zero where deleted instead of just leaving this message away.
COM_numberFormat($c);
// just in case we have more than 999)..
$msg .= "{$LANG28[80]}: {$c}<br" . XHTML . ">\n";
return $msg;
}
示例9: EVLIST_getField_rsvp
/**
* Display fields for the RSVP admin list
*
* @param string $fieldname Name of field
* @param mixed $fieldvalue Value of field
* @param array $A Array of all fields ($name=>$value)
* @param array $icon_arr Handy array of icon images
* @return string Field value formatted for display
*/
function EVLIST_getField_rsvp($fieldname, $fieldvalue, $A, $icon_arr)
{
global $_CONF, $LANG_ACCESS, $LANG_ADMIN;
USES_class_date();
$retval = '';
switch ($fieldname) {
case 'tic_count':
if ($fieldvalue <= $A['max_rsvp']) {
$retval = '';
} else {
$retval = 'Yes';
}
break;
case 'uid':
$retval = COM_getDisplayName($fieldvalue);
break;
case 'rank':
if ($fieldvalue > $A['max_signups']) {
$retval = 'Yes';
} else {
$retval = 'No';
}
break;
case 'dt':
case 'used':
if ($fieldvalue > 0) {
$d = new Date($fieldvalue, $_CONF['timezone']);
$retval = $d->format($_CONF['shortdate'] . ' ' . $_CONF['timeformat'], false);
} else {
$retval = '';
}
break;
default:
$retval = $fieldvalue;
break;
}
return $retval;
}
示例10: 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, $LANG27, $LANG_ACCESS, $LANG_ADMIN, $MESSAGE;
$retval = '';
if (empty($tid)) {
// new topic - set defaults
$A = array();
$A['tid'] = '';
$A['topic'] = '';
$A['sortnum'] = 0;
$A['limitnews'] = '';
// leave empty!
$A['is_default'] = 0;
$A['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 or $access == 2) {
$retval .= COM_startBlock($LANG27[12], '', COM_getBlockTemplate('_msg_block', 'header'));
$retval .= $LANG27[13];
$retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
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 = new Template($_CONF['path_layout'] . 'admin/topic');
$topic_templates->set_file('editor', 'topiceditor.thtml');
$topic_templates->set_var('xhtml', XHTML);
$topic_templates->set_var('site_url', $_CONF['site_url']);
$topic_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
$topic_templates->set_var('layout_url', $_CONF['layout_url']);
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('warning_msg', $LANG27[6]);
}
$topic_templates->set_var('lang_topicid', $LANG27[2]);
$topic_templates->set_var('topic_id', $A['tid']);
$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="3" maxlength="3" name="sortnum" value="' . $A['sortnum'] . '"' . XHTML . '>');
} else {
$topic_templates->set_var('lang_sortorder', $LANG27[14]);
$topic_templates->set_var('sort_order', $LANG27[15]);
}
$topic_templates->set_var('lang_storiesperpage', $LANG27[11]);
if ($A['limitnews'] == 0) {
$topic_templates->set_var('story_limit', '');
} else {
$topic_templates->set_var('story_limit', $A['limitnews']);
}
$topic_templates->set_var('default_limit', $_CONF['limitnews']);
$topic_templates->set_var('lang_defaultis', $LANG27[16]);
//.........这里部分代码省略.........
示例11: processDetailGetOutstandingTasks
function processDetailGetOutstandingTasks($project_id, &$template)
{
global $_TABLES, $CONF_NF, $usermodeUID;
// Retrieve any Outstanding Tasks
// Determine the unique process id's for this project
$sql = "SELECT wf_process_id,related_processes FROM {$_TABLES['nf_projects']} WHERE id='{$project_id}'";
$query = DB_QUERY($sql);
$A = DB_fetchArray($query);
if ($A['related_processes'] != '') {
$projectProcesses = explode(',', $A['related_processes']);
} else {
$projectProcesses = array();
}
array_push($projectProcesses, $A['wf_process_id']);
// Check and see if there are any child process of this parent process - will if this is a regenerated process
$A['wf_process_id'] = NXCOM_filterInt($A['wf_process_id']);
$query = DB_query("SELECT id FROM {$_TABLES['nf_process']} WHERE pid={$A['wf_process_id']}");
while ($P = DB_fetchArray($query)) {
array_push($projectProcesses, $P['id']);
}
$cid = 1;
if (count($projectProcesses > 0)) {
foreach ($projectProcesses as $process_id) {
// Get tasks that have assignment by variable
$template->set_var('taskuser', $usermodeUID);
$template->set_var('user_options', nf_listUsers());
if ($process_id > 0) {
$sql = "SELECT distinct a.id, a.nf_processID,d.taskname, d.nf_templateID, a.status, a.archived, ";
$sql .= "a.createdDate, c.uid, c.nf_processVariable, a.nf_templateDataID FROM {$_TABLES['nf_queue']} a ";
$sql .= "LEFT JOIN {$_TABLES['nf_templateassignment']} b ON a.nf_templateDataID = b.nf_templateDataID ";
$sql .= "LEFT JOIN {$_TABLES['nf_productionassignments']} c ON c.task_id = a.id ";
$sql .= "LEFT JOIN {$_TABLES['nf_templatedata']} d on a.nf_templateDataID = d.id ";
$sql .= "WHERE a.nf_processID = '{$process_id}' AND (a.archived IS NULL OR a.archived = 0)";
$sql .= "ORDER BY a.id";
$q2 = DB_query($sql);
while ($B = DB_fetchArray($q2, false)) {
if ($B['nf_processVariable'] == '') {
continue;
}
$template->set_var('taskassign_mode', 'variable');
$template->set_var('otaskid', $B['id']);
if (SEC_hasRights('nexflow.edit')) {
$template->set_var('otask_span', 1);
$template->set_var('show_otaskaction', '');
} else {
$template->set_var('otask_span', 2);
$template->set_var('show_otaskaction', 'none');
}
$template->set_var('otask_user', COM_getDisplayName($B['uid']));
$template->set_var('otask_name', $B['taskname']);
$template->set_var('otask_date', $B['createdDate']);
$template->set_var('otask_id', $B['id']);
$template->set_var('variable_id', $B['nf_processVariable']);
if ($cid == 1) {
$template->parse('outstandingtask_records', 'outstandingtasks');
} else {
$template->parse('outstandingtask_records', 'outstandingtasks', true);
}
$cid++;
}
// while
}
}
}
}
示例12: userprofile
/**
* Shows a profile for a user
*
* This grabs the user profile for a given user and displays it
*
* @param int $user User ID of profile to get
* @param int $msg Message to display (if != 0)
* @return string HTML for user profile page
*
*/
function userprofile($user, $msg = 0)
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG04, $LANG09, $LANG_LOGIN;
$retval = '';
if (empty($_USER['username']) && ($_CONF['loginrequired'] == 1 || $_CONF['profileloginrequired'] == 1)) {
$retval .= COM_siteHeader('menu');
$retval .= COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
$login = new Template($_CONF['path_layout'] . 'submit');
$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'));
$retval .= COM_siteFooter();
return $retval;
}
$result = DB_query("SELECT {$_TABLES['users']}.uid,username,fullname,regdate,homepage,about,location,pgpkey,photo,email FROM {$_TABLES['userinfo']},{$_TABLES['users']} WHERE {$_TABLES['userinfo']}.uid = {$_TABLES['users']}.uid AND {$_TABLES['users']}.uid = {$user}");
$nrows = DB_numRows($result);
if ($nrows == 0) {
// no such user
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$A = DB_fetchArray($result);
$display_name = COM_getDisplayName($user, $A['username'], $A['fullname']);
// format date/time to user preference
$curtime = COM_getUserDateTimeFormat($A['regdate']);
$A['regdate'] = $curtime[0];
$user_templates = new Template($_CONF['path_layout'] . 'users');
$user_templates->set_file(array('profile' => 'profile.thtml', 'row' => 'commentrow.thtml', 'strow' => 'storyrow.thtml'));
$user_templates->set_var('xhtml', XHTML);
$user_templates->set_var('site_url', $_CONF['site_url']);
$user_templates->set_var('start_block_userprofile', COM_startBlock($LANG04[1] . ' ' . $display_name));
$user_templates->set_var('end_block', COM_endBlock());
$user_templates->set_var('lang_username', $LANG04[2]);
if ($_CONF['show_fullname'] == 1) {
$user_templates->set_var('username', $A['fullname']);
$user_templates->set_var('user_fullname', $A['username']);
} else {
$user_templates->set_var('username', $A['username']);
$user_templates->set_var('user_fullname', $A['fullname']);
}
if (SEC_hasRights('user.edit')) {
global $_IMAGE_TYPE, $LANG_ADMIN;
$edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.' . $_IMAGE_TYPE . '" alt="' . $LANG_ADMIN['edit'] . '" title="' . $LANG_ADMIN['edit'] . '"' . XHTML . '>';
$edit_link_url = COM_createLink($edit_icon, "{$_CONF['site_admin_url']}/user.php?mode=edit&uid={$A['uid']}");
$user_templates->set_var('edit_link', $edit_link_url);
}
$photo = USER_getPhoto($user, $A['photo'], $A['email'], -1);
$user_templates->set_var('user_photo', $photo);
$user_templates->set_var('lang_membersince', $LANG04[67]);
$user_templates->set_var('user_regdate', $A['regdate']);
$user_templates->set_var('lang_email', $LANG04[5]);
$user_templates->set_var('user_id', $user);
$user_templates->set_var('lang_sendemail', $LANG04[81]);
$user_templates->set_var('lang_homepage', $LANG04[6]);
$user_templates->set_var('user_homepage', COM_killJS($A['homepage']));
$user_templates->set_var('lang_location', $LANG04[106]);
$user_templates->set_var('user_location', strip_tags($A['location']));
$user_templates->set_var('lang_bio', $LANG04[7]);
$user_templates->set_var('user_bio', nl2br(stripslashes($A['about'])));
$user_templates->set_var('lang_pgpkey', $LANG04[8]);
$user_templates->set_var('user_pgp', nl2br($A['pgpkey']));
$user_templates->set_var('start_block_last10stories', COM_startBlock($LANG04[82] . ' ' . $display_name));
$user_templates->set_var('start_block_last10comments', COM_startBlock($LANG04[10] . ' ' . $display_name));
$user_templates->set_var('start_block_postingstats', COM_startBlock($LANG04[83] . ' ' . $display_name));
$user_templates->set_var('lang_title', $LANG09[16]);
$user_templates->set_var('lang_date', $LANG09[17]);
// for alternative layouts: use these as headlines instead of block titles
$user_templates->set_var('headline_last10stories', $LANG04[82]);
$user_templates->set_var('headline_last10comments', $LANG04[10]);
$user_templates->set_var('headline_postingstats', $LANG04[83]);
$result = DB_query("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
$nrows = DB_numRows($result);
$tids = array();
for ($i = 0; $i < $nrows; $i++) {
$T = DB_fetchArray($result);
$tids[] = $T['tid'];
}
$topics = "'" . implode("','", $tids) . "'";
// list of last 10 stories by this user
if (count($tids) > 0) {
$sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = {$user}) AND (draft_flag = 0) AND (date <= NOW()) AND (tid IN ({$topics}))" . COM_getPermSQL('AND');
$sql .= " ORDER BY unixdate DESC LIMIT 10";
$result = DB_query($sql);
//.........这里部分代码省略.........
示例13: STORY_whatsRelated
/**
* Create "What's Related" links for a story
* Creates an HTML-formatted list of links to be used for the What's Related
* block next to a story (in article view).
*
* @param string $related contents of gl_stories 'related' field
* @param int $uid user id of the author
* @param int $sid story id
* @return string HTML-formatted list of links
*/
function STORY_whatsRelated($related, $uid, $sid)
{
global $_CONF, $_TABLES, $LANG24;
// Is it enabled?
// Disabled' => 0, 'Enabled' => 1, 'Enabled (No Links)' => 2, 'Enabled (No Outbound Links)' => 3
if ($_CONF['whats_related']) {
// get the links from the story text
if ($_CONF['whats_related'] != 2) {
if (!empty($related)) {
$rel = explode("\n", $related);
} else {
$rel = array();
}
// Used to hunt out duplicates. Stores urls that have already passed filters
$urls = array();
foreach ($rel as $key => &$value) {
if (preg_match("/<a[^>]*href=[\"']([^\"']*)[\"'][^>]*>(.*?)<\\/a>/i", $value, $matches) === 1) {
// Go through array and remove links with no link text except link. Since a max of only 23 characters of link text showen then compare only this
if (substr($matches[1], 0, 23) != substr($matches[2], 0, 23)) {
// Check if outbound links (if needed)
$passd_check = false;
if ($_CONF['whats_related'] == 3) {
// no outbound links
if ($_CONF['site_url'] == substr($matches[1], 0, strlen($_CONF['site_url']))) {
$passd_check = true;
}
} else {
$passd_check = true;
}
if ($passd_check) {
// Go through array and remove any duplicates of this link
if (in_array($matches[1], $urls)) {
// remove it from the array
unset($rel[$key]);
} else {
$urls[] = $matches[1];
// Now Check Words
$value = '<a href="' . $matches[1] . '">' . COM_checkWords($matches[2], 'story') . '</a>';
}
} else {
// remove it from the array
unset($rel[$key]);
}
} else {
// remove it from the array
unset($rel[$key]);
}
} else {
$value = COM_checkWords($value, 'story');
}
}
}
$topics = array();
if (!COM_isAnonUser() || $_CONF['loginrequired'] == 0 && $_CONF['searchloginrequired'] == 0) {
// add a link to "search by author"
if ($_CONF['contributedbyline'] == 1) {
$author = $LANG24[37] . ' ' . COM_getDisplayName($uid);
if ($_CONF['whats_related_trim'] > 0 && MBYTE_strlen($author) > $_CONF['whats_related_trim']) {
$author = substr($author, 0, $_CONF['whats_related_trim'] - 3) . '...';
}
$topics[] = "<a href=\"{$_CONF['site_url']}/search.php?mode=search&type=stories&author={$uid}\">{$author}</a>";
}
// Retrieve topics
$tids = TOPIC_getTopicIdsForObject('article', $sid, 0);
foreach ($tids as $tid) {
// add a link to "search by topic"
$topic = $LANG24[38] . ' ' . stripslashes(DB_getItem($_TABLES['topics'], 'topic', "tid = '{$tid}'"));
// trim topics if needed
if ($_CONF['whats_related_trim'] > 0 && MBYTE_strlen($topic) > $_CONF['whats_related_trim']) {
$topic = substr($topic, 0, $_CONF['whats_related_trim'] - 3) . '...';
}
$topics[] = '<a href="' . $_CONF['site_url'] . '/search.php?mode=search&type=stories&topic=' . $tid . '">' . $topic . '</a>';
}
}
// If line limit then split between related links and topics
if ($_CONF['whats_related_max'] > 0) {
if ($_CONF['whats_related_max'] < 3) {
$rel = array();
// Reset related links so at least user search and default topic search is displayed
$topics = array_slice($topics, 0, 2);
} else {
$rel_max_num_items = intval($_CONF['whats_related_max'] / 2);
$topic_max_num_items = $rel_max_num_items;
if ($rel_max_num_items + $topic_max_num_items != $_CONF['whats_related_max']) {
$topic_max_num_items = $topic_max_num_items + 1;
}
// Now check if we have enough topics to display else give it to links
$topic_num_items = count($topics);
$rel_num_items = count($rel);
$added_flag = false;
//.........这里部分代码省略.........
示例14: listNewDownloads
function listNewDownloads()
{
global $_CONF, $_FM_CONF, $_TABLES, $_TABLES, $myts, $eh, $mytree, $filemgmt_FileStore, $filemgmt_FileStoreURL, $filemgmt_FileSnapURL, $LANG_FM02;
// List downloads waiting for validation
$sql = "SELECT lid, cid, title, url, homepage, version, size, logourl, submitter, comments, platform ";
$sql .= "FROM {$_TABLES['filemgmt_filedetail']} where status=0 ORDER BY date DESC";
$result = DB_query($sql);
$numrows = DB_numRows($result);
$display = COM_siteHeader('menu');
// $display .= COM_startBlock('<b>'._MD_ADMINTITLE.'</b>');
$display .= filemgmt_navbar($LANG_FM02['nav4']);
$i = 1;
if ($numrows > 0) {
$display .= '<table width="100%" border="0" class="plugin">';
$display .= '<tr><td width="100%" class="pluginHeader" style="padding:5px;">' . _MD_DLSWAITING . " ({$numrows})</td></tr>";
while (list($lid, $cid, $title, $url, $homepage, $version, $size, $logourl, $submitter, $comments, $tmpnames) = DB_fetchArray($result)) {
$result2 = DB_query("SELECT description FROM {$_TABLES['filemgmt_filedesc']} WHERE lid='" . DB_escapeString($lid) . "'");
list($description) = DB_fetchArray($result2);
$title = $myts->makeTboxData4Edit($title);
$url = rawurldecode($myts->makeTboxData4Edit($url));
$logourl = rawurldecode($myts->makeTboxData4Edit($logourl));
$homepage = $myts->makeTboxData4Edit($homepage);
$version = $myts->makeTboxData4Edit($version);
$size = $myts->makeTboxData4Edit($size);
$description = $myts->makeTareaData4Edit($description);
$tmpfilenames = explode(";", $tmpnames);
$tempfileurl = $filemgmt_FileStoreURL . 'tmp/' . $tmpfilenames[0];
$tempfilepath = $filemgmt_FileStore . 'tmp/' . $tmpfilenames[0];
if (isset($tmpfilenames[1]) and $tmpfilenames[1] != '') {
$tempsnapurl = $filemgmt_FileSnapURL . 'tmp/' . $tmpfilenames[1];
} else {
$tempsnapurl = '';
}
$display .= '<tr><td>';
$display .= '<form action="index.php" method="post" enctype="multipart/form-data" style="margin:0px;">';
$display .= '<table width="100%" border="0" class="plugin">';
$display .= '<tr><td align="right" style="white-space:nowrap;">' . _MD_SUBMITTER . '</td><td>';
$display .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $submitter . '">' . COM_getDisplayName($submitter) . '</a>';
$display .= '</td></tr>';
$display .= '<tr><td align="right" style="white-space:nowrap;">' . _MD_FILETITLE . '</td><td>';
$display .= '<input type="text" name="title" size="50" maxlength="100" value="' . $title . '" />';
$display .= '</td></tr><tr><td align="right" style="white-space:nowrap;">' . _MD_DLFILENAME . '</td><td>';
$display .= '<input type="text" name="url" size="50" maxlength="250" value="' . $url . '" />';
$display .= '</td></tr>';
$display .= '<tr><td align="right" style="white-space:nowrap;">' . _MD_CATEGORYC . '</td><td>';
$display .= $mytree->makeMySelBox('title', 'title', $cid);
$display .= '</td></tr>';
$display .= '<tr><td align="right" style="white-space:nowrap;">' . _MD_HOMEPAGEC . '</td><td>';
$display .= '<input type="text" name="homepage" size="50" maxlength="100" value="' . $homepage . '" /></td></tr>';
$display .= '<tr><td align="right">' . _MD_VERSIONC . '</td><td>';
$display .= '<input type="text" name="version" size="10" maxlength="10" value="' . $version . '" /></td></tr>';
$display .= '<tr><td align="right">' . _MD_FILESIZEC . '</td><td>';
$display .= '<input type="text" name="size" size="10" maxlength="8" value="' . $size . '" disabled="disabled" /> ' . _MD_BYTES . '</td></tr>';
$display .= '<tr><td align="right" style="vertical-align:top;white-space:nowrap;">' . _MD_DESCRIPTIONC . '</td><td>';
$display .= '<textarea name=description cols="60" rows="5">' . $description . '</textarea>';
$display .= '</td></tr>';
$display .= '<tr><td align="right" style="white-space:nowrap;">' . _MD_SHOTIMAGE . '</td><td>';
$display .= '<input type="text" name="logourl" size="50" maxlength="250" value="' . $logourl . '" />';
if ($tempsnapurl != '') {
$display .= '<span style="padding-left:20px;"><a href="' . $tempsnapurl . '">Preview</a></span>';
}
$display .= '</td></tr>';
$display .= '<tr><td></td><td>';
$display .= '</td></tr><tr><td style="white-space:nowrap;" align="right">' . _MD_COMMENTOPTION . '</td><td>';
if ($comments) {
$display .= '<input type="radio" name="commentoption" value="1" checked="checked" /> ' . _MD_YES . ' ';
$display .= '<input type="radio" name="commentoption" value="0" /> ' . _MD_NO . ' ';
} else {
$display .= '<input type="radio" name="commentoption" value="1" /> ' . _MD_YES . ' ';
$display .= '<input type="radio" name="commentoption" value="0" checked="checked" /> ' . _MD_NO . ' ';
}
$display .= '</td></tr>';
$display .= '<tr><td style="text-align:right;padding:10px;">';
$display .= '<input type="submit" onclick=\'this.form.op.value="delNewDownload"\' value="Delete" />';
$display .= '<input type="hidden" name="op" value="" />';
$display .= '<input type="hidden" name="lid" value="' . $lid . '" />';
$display .= '<span style="padding-left:10px;">';
$display .= '<input type="submit" value="' . _MD_APPROVE . '" onclick=\'this.form.op.value="approve"\' /></span>';
if ($_FM_CONF['outside_webroot'] == 1) {
$display .= '</td><td style="padding:10px;">Download to preview: <a href="' . $_CONF['site_url'] . '/filemgmt/visit.php?tid=' . $lid . '">tempfile</a></td></tr>';
} else {
$display .= '</td><td style="padding:10px;">Download to preview: <a href="' . $tempfileurl . '">tempfile</a></td></tr>';
}
if ($numrows > 1 and $i < $numrows) {
$i++;
}
$display .= '</table></form></td></tr>';
}
$display .= '</table>';
} else {
$display .= '<div style="padding:20px">' . _MD_NOSUBMITTED . '</div>';
}
$display .= COM_endBlock();
$display .= COM_siteFooter();
echo $display;
}
示例15: PAGE_getListField
function PAGE_getListField($fieldname, $fieldvalue, $A, $icon_arr, $token)
{
global $_CONF, $_USER, $LANG_ADMIN, $LANG_STATIC, $LANG_ACCESS, $_TABLES;
$retval = '';
$access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
$enabled = $A['sp_status'] == 1 ? true : false;
$dt = new Date('now', $_USER['tzid']);
switch ($fieldname) {
case 'edit':
if ($access == 3) {
$attr['title'] = $LANG_ADMIN['edit'];
$retval = COM_createLink($icon_arr['edit'], $_CONF['site_admin_url'] . '/plugins/staticpages/index.php' . '?edit=x&sp_id=' . $A['sp_id'], $attr);
} else {
$retval = $icon_arr['blank'];
}
break;
case 'copy':
if ($access >= 2) {
$attr['title'] = $LANG_ADMIN['copy'];
$retval = COM_createLink($icon_arr['copy'], $_CONF['site_admin_url'] . '/plugins/staticpages/index.php' . '?clone=x&sp_id=' . $A['sp_id'], $attr);
} else {
$retval = $icon_arr['blank'];
}
break;
case "sp_title":
$sp_title = $A['sp_title'];
if ($enabled) {
$url = COM_buildUrl($_CONF['site_url'] . '/page.php?page=' . $A['sp_id']);
$retval = COM_createLink($sp_title, $url, array('title' => $LANG_STATIC['title_display']));
} else {
$retval = '<span class="disabledfield">' . $sp_title . '</span>';
}
break;
case 'access':
if ($access == 3) {
$privs = $LANG_ACCESS['edit'];
} else {
$privs = $LANG_ACCESS['readonly'];
}
$retval = $enabled ? $privs : '<span class="disabledfield">' . $privs . '</span>';
break;
case "sp_uid":
$owner = COM_getDisplayName($A['sp_uid']);
$retval = $enabled ? $owner : '<span class="disabledfield">' . $owner . '</span>';
break;
case "sp_centerblock":
if ($A['sp_centerblock']) {
switch ($A['sp_where']) {
case '1':
$where = $LANG_STATIC['centerblock_top'];
break;
case '2':
$where = $LANG_STATIC['centerblock_feat'];
break;
case '3':
$where = $LANG_STATIC['centerblock_bottom'];
break;
default:
$where = $LANG_STATIC['centerblock_entire'];
break;
}
} else {
$where = $LANG_STATIC['centerblock_no'];
}
$retval = $enabled ? $where : '<span class="disabledfield">' . $where . '</span>';
break;
case "unixdate":
$dt->setTimestamp($A['unixdate']);
$datetime = $dt->format($_CONF['daytime'], true);
$retval = $enabled ? $datetime : '<span class="disabledfield">' . $datetime . '</span>';
break;
case 'delete':
if ($access == 3) {
$attr['title'] = $LANG_ADMIN['delete'];
$attr['onclick'] = "return confirm('" . $LANG_STATIC['delete_confirm'] . "');";
$retval = COM_createLink($icon_arr['delete'], $_CONF['site_admin_url'] . '/plugins/staticpages/index.php' . '?delete=x&sp_id=' . $A['sp_id'] . '&' . CSRF_TOKEN . '=' . $token, $attr);
} else {
$retval = $icon_arr['blank'];
}
break;
case 'sp_status':
if ($access == 3) {
if ($enabled) {
$switch = ' checked="checked"';
$title = 'title="' . $LANG_ADMIN['disable'] . '" ';
} else {
$title = 'title="' . $LANG_ADMIN['enable'] . '" ';
$switch = '';
}
$retval = '<input class="sp-enabler" type="checkbox" name="enabledstaticpages[' . $A['sp_id'] . ']" ' . $title . 'onclick="submit()" value="1"' . $switch . '/>';
$retval .= '<input type="hidden" name="sp_idarray[' . $A['sp_id'] . ']" value="1" />';
} else {
$retval = $enabled ? $LANG_ACCESS['yes'] : $LANG_ACCESS['No'];
}
break;
default:
$retval = $enabled ? $fieldvalue : '<span class="disabledfield">' . $fieldvalue . '</span>';
break;
}
return $retval;
//.........这里部分代码省略.........