作者:NewRout
项目:paypa
/**
* Display the detail page for the product.
*
* @return string HTML for the product page.
*/
public function Detail()
{
global $_CONF, $_PP_CONF, $_TABLES, $LANG_PP, $_USER;
USES_lib_comments();
$prod_id = $this->id;
if ($prod_id < 1 || !$this->enabled) {
return PAYPAL_errorMessage($LANG_PP['invalid_product_id'], 'info');
}
$retval = COM_startBlock();
// Set the template dir based on the configured template version
$T = new Template(PAYPAL_PI_PATH . '/templates/detail' . $_PP_CONF['tpl_ver_detail']);
if ($this->hasAttributes()) {
$detail_template = 'product_detail_attrib.thtml';
} else {
$detail_template = 'product_detail.thtml';
}
$T->set_file('product', $detail_template);
$name = $this->name;
$l_desc = PLG_replaceTags($this->description);
$s_desc = PLG_replaceTags($this->short_description);
// Highlight the query terms if coming from a search
if (isset($_REQUEST['query']) && !empty($_REQUEST['query'])) {
$name = COM_highlightQuery($name, $_REQUEST['query']);
$l_desc = COM_highlightQuery($l_desc, $_REQUEST['query']);
$s_desc = COM_highlightQuery($s_desc, $_REQUEST['query']);
}
$act_price = $this->sale_price == $this->price ? $this->price : $this->sale_price;
$T->set_var(array('id' => $prod_id, 'name' => $name, 'short_description' => $s_desc, 'description' => $l_desc, 'cur_decimals' => $this->currency->Decimals(), 'price' => $this->currency->FormatValue($act_price), 'orig_price' => $this->currency->Format($this->price), 'on_sale' => $act_price == $this->price ? '' : 'true', 'img_cell_width' => $_PP_CONF['max_thumb_size'] + 20, 'price_prefix' => $this->currency->Pre(), 'price_postfix' => $this->currency->Post(), 'onhand' => $this->track_onhand ? $this->onhand : ''));
// Retrieve the photos and put into the template
$sql = "SELECT img_id, filename\n FROM {$_TABLES['paypal.images']} \n WHERE product_id='{$prod_id}'";
//echo $sql;die;
$img_res = DB_query($sql);
$photo_detail = '';
$T->set_var('have_photo', '');
// assume no photo available
if ($img_res && DB_numRows($img_res) > 0) {
for ($i = 0; $prow = DB_fetchArray($img_res, false); $i++) {
if ($prow['filename'] != '' && file_exists("{$_PP_CONF['image_dir']}/{$prow['filename']}")) {
if ($i == 0) {
$T->set_var('main_img', $prow['filename']);
}
$T->set_block('product', 'Thumbnail', 'PBlock');
$T->set_var('img_file', $prow['filename']);
$T->set_var('img_url', PAYPAL_URL . '/images/products');
$T->set_var('thumb_url', PAYPAL_ImageUrl($prow['filename']));
$T->parse('PBlock', 'Thumbnail', true);
$T->set_var('have_photo', 'true');
}
}
}
// Get the product options, if any, and set them into the form
$i = 0;
$cbrk = '';
$attributes = '';
foreach ($this->options as $id => $Attr) {
if ($Attr['attr_name'] != $cbrk) {
if ($i > 0) {
$attributes .= "</select></td></tr>\n";
} else {
$attributes = '<table border="0">' . "\n";
}
$cbrk = $Attr['attr_name'];
$attributes .= "<tr><td>\n <input type=\"hidden\" name=\"on{$i}\" \n value=\"{$Attr['attr_name']}\">\n\n <input type=\"hidden\" name=\"os{$i}\" \n value=\"\">\n\n {$Attr['attr_name']}:</td>\n <td align=\"left\">\n <select name=\"options[]\"\n onchange=\"ProcessForm(this.form);\">\n";
/*<td align=\"left\"><select name=\"pp_os{$i}\"*/
$i++;
}
if ($Attr['attr_price'] != 0) {
$attr_str = sprintf(" ( %+.2f )", $Attr['attr_price']);
} else {
$attr_str = '';
}
$attributes .= '<option value="' . $id . '|' . $Attr['attr_value'] . '|' . $Attr['attr_price'] . '">' . $Attr['attr_value'] . $attr_str . '</option>' . LB;
}
if ($attributes != '') {
$attributes .= "</select></td></tr></table>\n";
$T->set_var('attributes', $attributes);
}
$buttons = $this->PurchaseLinks();
$T->set_block('product', 'BtnBlock', 'Btn');
foreach ($buttons as $name => $html) {
$T->set_var('button', $html);
$T->parse('Btn', 'BtnBlock', true);
}
// Show the user comments if enabled globally and for this product
if (plugin_commentsupport_paypal() && $this->comments_enabled != PP_COMMENTS_DISABLED) {
// if enabled or closed
if ($_CONF['commentsloginrequired'] == 1 && COM_isAnonUser()) {
// Set mode to "disabled"
$mode = -1;
} else {
$mode = $this->comments_enabled;
}
$T->set_var('usercomments', CMT_userComments($prod_id, $this->short_description, 'paypal', '', '', 0, 1, false, false, $mode));
}
if ($this->rating_enabled == 1) {
//.........这里部分代码省略.........
作者:NewRout
项目:glfusio
//.........这里部分代码省略.........
$voted = 1;
} else {
$static = 0;
$voted = 0;
}
}
if ($MG_albums[$this->album_id]->enable_rating == 1 && COM_isAnonUser()) {
$static = true;
}
if ($_MG_CONF['use_large_stars'] == 1) {
$starSize = '';
} else {
$starSize = 'sm';
}
$rating_box = RATING_ratingBar('mediagallery', $this->id, $this->votes, $this->rating, $voted, 5, $static, $starSize);
} else {
$rating_box = '';
}
$T->set_var('rating_box', '<center>' . $rating_box . '</center>');
$fs_bytes = @filesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $this->filename[0] . '/' . $this->filename . '.' . $this->mime_ext);
$fileSize = MG_get_size($fs_bytes);
$direct_url = 'disp/' . $this->filename[0] . '/' . $this->filename . '.' . $this->mime_ext;
if (!file_exists($_MG_CONF['path_mediaobjects'] . $direct_url)) {
$direct_url = 'disp/' . $this->filename[0] . '/' . $this->filename . '.jpg';
}
if ($MG_albums[$this->album_id]->access == 3) {
$edit_item = '<a href="' . $_MG_CONF['site_url'] . '/admin.php?mode=mediaedit&s=1&album_id=' . $this->album_id . '&mid=' . $this->id . '">' . $LANG_MG01['edit'] . '</a>';
} else {
$edit_item = '';
}
$L = new Template(MG_getTemplatePath($this->album_id));
$L->set_file('media_link', 'medialink.thtml');
$L->set_var('href', $url_media_item);
if ($this->type == 0) {
if ($this->remote == 1) {
$L->set_var('hrefdirect', $this->remote_url);
} else {
$L->set_var('hrefdirect', $_MG_CONF['mediaobjects_url'] . '/' . $direct_url);
}
}
$caption = PLG_replaceTags(str_replace('$', '$', $this->title), 'mediagallery', 'media_description');
if ($this->owner_id == $_USER['uid'] || SEC_hasRights('mediagallery.admin')) {
$caption .= '<br />(' . $this->id . ')';
}
$L->set_var('caption', $caption);
$L->set_var('id', 'id' . rand());
$L->parse('media_link_start', 'media_link');
$media_start_link = $L->finish($L->get_var('media_link_start'));
$T->set_var(array('play_now' => '', 'download_now' => $_MG_CONF['site_url'] . '/download.php?mid=' . $this->id, 'play_in_popup' => "javascript:showVideo('" . $_MG_CONF['site_url'] . '/video.php?n=' . $this->id . "'," . $resolution_y . ',' . $resolution_x . ')', 'row_height' => $tn_height + 40, 'media_title' => PLG_replaceTags($this->title, 'mediagallery', 'media_title'), 'media_description' => PLG_replaceTags(nl2br($this->description), 'mediagallery', 'media_description'), 'media_tag' => strip_tags($this->title), 'media_time' => $media_time[0], 'upload_time' => $upload_time[0], 'media_owner' => $username, 'site_url' => $_MG_CONF['site_url'], 'lang_published' => $LANG_MG03['published'], 'lang_on' => $LANG_MG03['on'], 'lang_hyphen' => $this->album == '' ? '' : '-', 'media_link_start' => $media_start_link, 'media_link_end' => '</a>', 'artist' => $this->artist, 'musicalbum' => $this->album != '' ? $this->album : '', 'genre' => $this->genre != '' ? $this->genre : '', 'alt_edit_link' => $edit_item, 'filesize' => $fileSize, 'media_id' => $this->id, 'raw_media_thumbnail' => $media_thumbnail, 'display_url' => $url_media_item));
// frame template variables
$F->set_var(array('media_id' => $this->id, 'media_link_start' => $media_start_link, 'media_link_end' => '</a>', 'url_media_item' => $url_media_item, 'url_display_item' => $url_display_item, 'media_thumbnail' => $media_thumbnail, 'media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'media_height' => $newheight, 'media_width' => $newwidth, 'border_width' => $newwidth + 15, 'border_height' => $newheight + 15, 'row_height' => $tn_height + 40, 'frWidth' => $newwidth - $MG_albums[$this->album_id]->frWidth, 'frHeight' => $newheight - $MG_albums[$this->album_id]->frHeight, 'media_tag' => strip_tags($this->description), 'filesize' => $fileSize));
$F->parse('media', 'media_frame');
$media_item_thumbnail = $F->finish($F->get_var('media'));
$T->set_var(array('media_item_thumbnail' => $media_item_thumbnail, 'url_media_item' => $url_media_item, 'url_display_item' => $url_display_item, 'media_thumbnail' => $media_thumbnail, 'media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"'));
if ($MG_albums[$this->album_id]->enable_keywords) {
if (!empty($this->keywords)) {
$kwText = '';
$keyWords = array();
$keyWords = explode(' ', $this->keywords);
$numKeyWords = count($keyWords);
for ($i = 0; $i < $numKeyWords; $i++) {
$keyWords[$i] = str_replace('"', ' ', $keyWords[$i]);
$searchKeyword = $keyWords[$i];
$keyWords[$i] = str_replace('_', ' ', $keyWords[$i]);
$kwText .= '<a href="' . $_MG_CONF['site_url'] . '/search.php?mode=search&swhere=1&keywords=' . $searchKeyword . '&keyType=any">' . $keyWords[$i] . '</a> ';
}
$T->set_var(array('media_keywords' => $kwText, 'lang_keywords' => $LANG_MG01['keywords']));
$T->parse('media_cell_keywords', 'media_cell_keywords');
} else {
$T->set_var('lang_keywords', '');
}
} else {
$T->set_var(array('media_cell_keywords' => '', 'lang_keywords' => ''));
}
if ($MG_albums[$this->album_id]->enable_rating) {
$rating = $LANG_MG03['rating'] . ': <strong> ' . $this->rating / 2 . '</strong>/5 (' . $this->votes . ' ' . $LANG_MG03['votes'] . ')';
$T->set_var('media_rating', $rating);
$T->parse('media_rate_results', 'media_rate_results');
}
if ($MG_albums[$this->album_id]->enable_comments) {
if ($this->type == 4 || $this->type == 1 && $MG_albums[$this->album_id]->playback_type != 2 || $this->type == 2 && $MG_albums[$this->album_id]->playback_type != 2 || $this->type == 5 && $MG_albums[$this->album_id]->playback_type != 2) {
$cmtLink = '<a href="' . $_MG_CONF['site_url'] . '/media.php?f=0' . '&sort=' . $sortOrder . '&s=' . $this->id . '">' . $LANG_MG03['comments'] . '</a>';
$cmtLink_alt = '';
} else {
$cmtLink = $LANG_MG03['comments'];
$cmtLink_alt = '<a href="' . $_MG_CONF['site_url'] . '/media.php?f=0' . '&sort=' . $sortOrder . '&s=' . $this->id . '">' . $LANG_MG03['comments'] . '</a>';
}
$T->set_var(array('media_comments_count' => $this->comments, 'lang_comments' => $cmtLink, 'lang_comments_hot' => $cmtLink_alt));
$T->parse('media_comments', 'media_comments');
}
if ($MG_albums[$this->album_id]->enable_views) {
$T->set_var(array('media_views_count' => $this->views, 'lang_views' => $LANG_MG03['views']));
$T->parse('media_views', 'media_views');
}
$T->set_var(array('max-width' => $tn_width));
PLG_templateSetVars('mediagallery', $T);
$T->parse('media_cell', 'media_cell_image');
$retval = $T->finish($T->get_var('media_cell'));
return $retval;
}
作者:milk5
项目:geeklog-japa
/**
* Callback function for the ListFactory class
*
* This function gets called by the ListFactory class and formats
* each row accordingly for example pulling usernames from the
* users table and displaying a link to their profile.
*
* @param array $row An array of plain data to format
* @return array A reformatted version of the input array
*
*/
public function searchFormatCallback($preSort, $row)
{
global $_CONF, $LANG09;
if ($preSort) {
if (is_array($row[LF_SOURCE_TITLE])) {
$row[LF_SOURCE_TITLE] = implode($_CONF['search_separator'], $row[LF_SOURCE_TITLE]);
}
if (is_numeric($row['uid'])) {
if (empty($this->_names[$row['uid']])) {
$this->_names[$row['uid']] = htmlspecialchars(COM_getDisplayName($row['uid']));
if ($row['uid'] != 1) {
$this->_names[$row['uid']] = COM_createLink($this->_names[$row['uid']], $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $row['uid']);
}
}
$row['uid'] = $this->_names[$row['uid']];
}
} else {
$row[LF_SOURCE_TITLE] = COM_createLink($row[LF_SOURCE_TITLE], $this->_searchURL . '&type=' . $row[LF_SOURCE_NAME] . '&mode=search');
if ($row['url'] != '#') {
$row['url'] = ($row['url'][0] == '/' ? $_CONF['site_url'] : '') . $row['url'];
if (isset($this->_url_rewrite[$row[LF_SOURCE_NAME]]) && $this->_url_rewrite[$row[LF_SOURCE_NAME]]) {
$row['url'] = COM_buildUrl($row['url']);
}
if (isset($this->_append_query[$row[LF_SOURCE_NAME]]) && $this->_append_query[$row[LF_SOURCE_NAME]]) {
if (!empty($this->_query)) {
$row['url'] .= (strpos($row['url'], '?') ? '&' : '?') . 'query=' . urlencode($this->_query);
}
}
}
$row['title'] = $this->_shortenText($this->_query, $row['title'], 8);
$row['title'] = stripslashes(str_replace('$', '$', $row['title']));
$row['title'] = COM_createLink($row['title'], $row['url']);
if ($row['description'] == 'LF_NULL') {
$row['description'] = '<i>' . $LANG09[70] . '</i>';
} elseif ($row['description'] != '<i>' . $LANG09[70] . '</i>') {
$row['description'] = stripslashes($this->_shortenText($this->_query, PLG_replaceTags($row['description']), $this->_wordlength));
}
if ($row['date'] != 'LF_NULL') {
$dt = COM_getUserDateTimeFormat(intval($row['date']));
$row['date'] = $dt[0];
}
if ($row['hits'] != 'LF_NULL') {
$row['hits'] = COM_NumberFormat($row['hits']) . ' ';
// simple solution to a silly problem!
}
}
return $row;
}
作者:milk5
项目:geeklog-japa
/**
* 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;
}
作者:alxstuar
项目:ajfs.m
/**
* Get an existing static page
*
* @param array args Contains all the data provided by the client
* @param string &output OUTPUT parameter containing the returned text
* @param string &svc_msg OUTPUT parameter containing any service messages
* @return int Response code as defined in lib-plugins.php
*/
function service_get_staticpages($args, &$output, &$svc_msg)
{
global $_CONF, $_TABLES, $LANG_ACCESS, $LANG12, $LANG_STATIC, $_SP_CONF;
$output = '';
$svc_msg['output_fields'] = array('sp_hits', 'sp_format', 'draft_flag', 'owner_id', 'group_id', 'perm_owner', 'perm_group', 'perm_members', 'perm_anon', 'sp_help', 'sp_php', 'sp_inblock', 'commentcode');
if (empty($args['sp_id']) && !empty($args['id'])) {
$args['sp_id'] = $args['id'];
}
if ($args['gl_svc']) {
if (isset($args['sp_id'])) {
$args['sp_id'] = COM_applyBasicFilter($args['sp_id']);
}
if (isset($args['mode'])) {
$args['mode'] = COM_applyBasicFilter($args['mode']);
}
if (empty($args['sp_id'])) {
$svc_msg['gl_feed'] = true;
} else {
$svc_msg['gl_feed'] = false;
}
} else {
$svc_msg['gl_feed'] = false;
}
if (!$svc_msg['gl_feed']) {
$page = '';
if (isset($args['sp_id'])) {
$page = $args['sp_id'];
}
$mode = '';
if (isset($args['mode'])) {
$mode = $args['mode'];
}
$error = 0;
if ($page == '') {
$error = 1;
}
$perms = SP_getPerms();
if (!SEC_hasRights('staticpages.edit')) {
if (!empty($perms)) {
$perms .= ' AND';
}
$perms .= '(draft_flag = 0)';
}
if (!empty($perms)) {
$perms = ' AND ' . $perms;
}
$sql = array();
$sql['mysql'] = "SELECT sp_title,sp_page_title,sp_content,sp_hits,created,modified,sp_format," . "commentcode,meta_description,meta_keywords,template_flag,template_id,draft_flag," . "owner_id,group_id,perm_owner,perm_group," . "perm_members,perm_anon,sp_tid,sp_help,sp_php," . "sp_inblock FROM {$_TABLES['staticpage']} " . "WHERE (sp_id = '{$page}')" . $perms;
$sql['mssql'] = "SELECT sp_title,sp_page_title," . "CAST(sp_content AS text) AS sp_content,sp_hits," . "created,modified,sp_format,commentcode," . "CAST(meta_description AS text) AS meta_description," . "CAST(meta_keywords AS text) AS meta_keywords,template_flag,template_id,draft_flag," . "owner_id,group_id,perm_owner,perm_group,perm_members," . "perm_anon,sp_tid,sp_help,sp_php,sp_inblock " . "FROM {$_TABLES['staticpage']} WHERE (sp_id = '{$page}')" . $perms;
$sql['pgsql'] = "SELECT sp_title,sp_page_title,sp_content,sp_hits," . "created,modified,sp_format," . "commentcode,meta_description,meta_keywords,template_flag,template_id,draft_flag," . "owner_id,group_id,perm_owner,perm_group," . "perm_members,perm_anon,sp_tid,sp_help,sp_php," . "sp_inblock FROM {$_TABLES['staticpage']} " . "WHERE (sp_id = '{$page}')" . $perms;
$result = DB_query($sql);
$count = DB_numRows($result);
if ($count == 0 || $count > 1) {
$error = 1;
}
if (!$error) {
$output = DB_fetchArray($result, false);
// WE ASSUME $output doesn't have any confidential fields
if ($output['template_id'] != '') {
$retval = '';
$mode = '';
$xmlObject = simplexml_load_string($output['sp_content']);
// create array of XML data
$tag = array();
foreach ($xmlObject->variable as $variable) {
$key = $variable["name"] . '';
$value = $variable->data;
$tag[$key] = $value;
}
// Loop through variables to replace any autotags first
foreach ($tag as &$value) {
$value = PLG_replaceTags($value);
}
$args = array('sp_id' => $output['template_id'], 'mode' => $mode, 'gl_svc' => '');
$svc_msg = array();
if (PLG_invokeService('staticpages', 'get', $args, $retval, $svc_msg) == PLG_RET_OK) {
$retval['sp_content'] = str_replace(array_keys($tag), array_values($tag), $retval['sp_content']);
$output['sp_content'] = $retval['sp_content'];
}
}
} else {
// an error occured (page not found, access denied, ...)
/**
* if the user has edit permissions and the page does not exist,
* send them to the editor so they can create it "wiki style"
*/
$create_page = false;
if ($mode !== 'autotag' && $count == 0 && SEC_hasRights('staticpages.edit')) {
// check again without permissions
if (DB_count($_TABLES['staticpage'], 'sp_id', $page) == 0) {
$url = $_CONF['site_admin_url'] . '/plugins/staticpages/index.php?mode=edit&sp_new_id=' . $page . '&msg=21';
$output = COM_refresh($url);
//.........这里部分代码省略.........
作者:spacequa
项目:glfusio
public function _replaceTags($text)
{
return PLG_replaceTags($text, $this->namespace, $this->operation);
}
作者:mystralk
项目:geeklo
/**
* Config Option has changed. (use plugin api)
*
* @return void
*/
function plugin_configchange_article($group, $changes = array())
{
global $_TABLES, $_CONF;
// If trim length changes then need to redo all related url's for articles
if ($group == 'Core' && in_array('whats_related_trim', $changes)) {
$sql = "SELECT sid, introtext, bodytext FROM {$_TABLES['stories']}";
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
for ($x = 0; $x < $nrows; $x++) {
$A = DB_fetchArray($result);
// Should maybe retrieve through story service but just grab from database and apply any autotags
// This is all the related story column should really need
$fulltext = PLG_replaceTags($A['introtext']) . ' ' . PLG_replaceTags($A['bodytext']);
$related = DB_escapeString(implode("\n", STORY_extractLinks($fulltext, $_CONF['whats_related_trim'])));
if (!empty($related)) {
DB_query("UPDATE {$_TABLES['stories']} SET related = '{$related}' WHERE sid = '{$A['sid']}'");
}
}
}
// For if any articles are being cached
} elseif ($group == 'Core' && (in_array('site_name', $changes) || in_array('contributedbyline', $changes) || in_array('allow_user_photo', $changes) || in_array('article_image_align', $changes) || in_array('related_topics', $changes) || in_array('related_topics_max', $changes) || in_array('allow_page_breaks', $changes) || in_array('page_break_comments', $changes) || in_array('url_rewrite', $changes) || in_array('url_routing', $changes) || in_array('hideviewscount', $changes) || in_array('hideemailicon', $changes) || in_array('loginrequired', $changes) || in_array('emailstoryloginrequired', $changes) || in_array('hideprintericon', $changes))) {
// If any Article options changed then delete all article cache
$cacheInstance = 'article__';
CACHE_remove_instance($cacheInstance);
}
}
作者:hostelleri
项目:nexpr
/**
* Return information for a story
*
* This is the story equivalent of PLG_getItemInfo. See lib-plugins.php for
* details.
*
* @param string $sid story ID or '*'
* @param string $what comma-separated list of story properties
* @param int $uid user ID or 0 = current user
* @param array $options (reserved for future extensions)
* @return mixed string or array of strings with the information
*
*/
function STORY_getItemInfo($sid, $what, $uid = 0, $options = array())
{
global $_CONF, $_TABLES;
// parse $what to see what we need to pull from the database
$properties = explode(',', $what);
$fields = array();
foreach ($properties as $p) {
switch ($p) {
case 'date-created':
$fields[] = 'UNIX_TIMESTAMP(date) AS unixdate';
break;
case 'description':
$fields[] = 'introtext';
$fields[] = 'bodytext';
break;
case 'excerpt':
$fields[] = 'introtext';
break;
case 'feed':
$fields[] = 'tid';
break;
case 'id':
$fields[] = 'sid';
break;
case 'title':
$fields[] = 'title';
break;
case 'url':
// needed for $sid == '*', but also in case we're only requesting
// the URL (so that $fields isn't emtpy)
$fields[] = 'sid';
break;
default:
// nothing to do
break;
}
}
$fields = array_unique($fields);
if (count($fields) == 0) {
$retval = array();
return $retval;
}
// prepare SQL request
if ($sid == '*') {
$where = ' WHERE';
} else {
$where = " WHERE (sid = '" . addslashes($sid) . "') AND";
}
$where .= ' (draft_flag = 0) AND (date <= NOW())';
if ($uid > 0) {
$permSql = COM_getPermSql('AND', $uid) . COM_getTopicSql('AND', $uid);
} else {
$permSql = COM_getPermSql('AND') . COM_getTopicSql('AND');
}
$sql = "SELECT " . implode(',', $fields) . " FROM {$_TABLES['stories']}" . $where . $permSql;
if ($sid != '*') {
$sql .= ' LIMIT 1';
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
$retval = array();
for ($i = 0; $i < $numRows; $i++) {
$A = DB_fetchArray($result);
$props = array();
foreach ($properties as $p) {
switch ($p) {
case 'date-created':
$props['date-created'] = $A['unixdate'];
break;
case 'description':
$props['description'] = trim(PLG_replaceTags(stripslashes($A['introtext']) . ' ' . stripslashes($A['bodytext'])));
break;
case 'excerpt':
$excerpt = stripslashes($A['introtext']);
if (!empty($A['bodytext'])) {
$excerpt .= "\n\n" . stripslashes($A['bodytext']);
}
$props['excerpt'] = trim(PLG_replaceTags($excerpt));
break;
case 'feed':
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '::all'");
if (empty($feedfile)) {
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '::frontpage'");
}
if (empty($feedfile)) {
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '{$A['tid']}'");
}
//.........这里部分代码省略.........
作者:spacequa
项目:glfusio
//.........这里部分代码省略.........
}
$archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1");
$sql = " (date <= NOW()) AND (draft_flag = 0)";
if (empty($topic)) {
$sql .= COM_getLangSQL('tid', 'AND', 's');
}
// if a topic was provided only select those stories.
if (!empty($topic)) {
$sql .= " AND s.tid = '" . DB_escapeString($topic) . "' ";
}
if ($featured == 1) {
$sql .= " AND s.featured = 1 ";
} else {
if ($featured == 2) {
$sql .= " AND s.featured = 0 ";
}
}
if ($frontpage == 1) {
$sql .= " AND frontpage = 1 ";
}
if ($topic != $archivetid) {
$sql .= " AND s.tid != '{$archivetid}' ";
}
$sql .= COM_getPermSQL('AND', 0, 2, 's');
$sql .= COM_getTopicSQL('AND', 0, 's') . ' ';
$userfields = 'u.uid, u.username, u.fullname';
if ($_CONF['allow_user_photo'] == 1) {
$userfields .= ', u.photo';
if ($_CONF['use_gravatar']) {
$userfields .= ', u.email';
}
}
$orderBy = ' date DESC ';
$headlinesSQL = "SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS unixdate, " . 'UNIX_TIMESTAMP(s.expire) as expireunix, ' . $userfields . ", t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, " . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND" . $sql . "ORDER BY featured DESC," . $orderBy;
if ($display > 0) {
$headlinesSQL .= " LIMIT " . $display;
}
$result = DB_query($headlinesSQL);
$numRows = DB_numRows($result);
if ($numRows < $cols) {
$cols = $numRows;
}
if ($cols > 6) {
$cols = 6;
}
if ($numRows > 0) {
$T = new Template($_CONF['path'] . 'system/autotags/');
$T->set_file('page', $template);
$T->set_var('columns', $cols);
$T->set_block('page', 'headlines', 'hl');
$newstories = array();
while ($A = DB_fetchArray($result)) {
$T->unset_var('readmore_url');
$T->unset_var('lang_readmore');
if ($A['attribution_author'] != '') {
$author = $A['attribution_author'];
} else {
$author = $A['username'];
}
$title = COM_undoSpecialChars($A['title']);
$title = str_replace(' ', ' ', $title);
$subtitle = COM_undoSpecialChars($A['subtitle']);
if ($A['story_image'] != '') {
$story_image = $_CONF['site_url'] . $A['story_image'];
} else {
$story_image = '';
}
$A['introtext'] = STORY_renderImages($A['sid'], $A['introtext']);
if (!empty($A['bodytext'])) {
$closingP = strrpos($A['introtext'], "</p>");
if ($closingP !== FALSE) {
$text = substr($A['introtext'], 0, $closingP);
$A['introtext'] = $text;
}
// adds the read more link
$T->set_var('readmore_url', COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']));
$T->set_var('lang_readmore', $LANG01['continue_reading']);
}
if ($truncate > 0) {
$A['introtext'] = $this->truncateHTML($A['introtext'], $truncate, '...');
}
$topicurl = $_CONF['site_url'] . '/index.php?topic=' . $A['tid'];
$dt->setTimestamp($A['unixdate']);
if ($A['commentcode'] >= 0) {
$cmtLinkArray = CMT_getCommentLinkWithCount('article', $A['sid'], $_CONF['site_url'] . '/article.php?story=' . $A['sid'], $A['comments'], 1);
$T->set_var(array('lang_comments' => '', 'comments_count' => $cmtLinkArray['comment_count'], 'comments_url' => $cmtLinkArray['url'], 'comments_url_extra' => $cmtLinkArray['url_extra']));
} else {
$T->unset_var('lang_comments');
$T->unset_var('comments_count');
$T->unset_var('comments_url');
$T->unset_var('comments_url_extra');
}
$T->set_var(array('titlelink' => $titleLink ? TRUE : '', 'meta' => $meta ? TRUE : '', 'lang_by' => $LANG01[95], 'lang_posted_in' => $LANG01['posted_in'], 'story_topic_url' => $topicurl, 'title' => $title, 'subtitle' => $subtitle, 'story_image' => $story_image, 'text' => PLG_replaceTags($A['introtext']), 'date' => $A['date'], 'time' => $dt->format('Y-m-d', true) . 'T' . $dt->format('H:i:s', true), 'topic' => $A['topic'], 'tid' => $A['tid'], 'author' => $author, 'author_id' => $A['uid'], 'sid' => $A['sid'], 'short_date' => $dt->format($_CONF['shortdate'], true), 'date_only' => $dt->format($_CONF['dateonly'], true), 'date' => $dt->format($dt->getUserFormat(), true), 'url' => COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']), 'attribution_url' => $A['attribution_url'], 'attribution_name' => $A['attribution_name']));
$T->parse('hl', 'headlines', true);
}
$retval = $T->finish($T->parse('output', 'page'));
CACHE_create_instance($instance_id, $retval, 0);
}
return $retval;
}
作者:hostelleri
项目:nexpr
//.........这里部分代码省略.........
}
} elseif (SEC_hasRights('comment.moderate')) {
$edit_option = true;
}
// edit link
$edit = '';
if ($edit_option) {
$editlink = $_CONF['site_url'] . '/comment.php?mode=edit&cid=' . $A['cid'] . '&sid=' . $A['sid'] . '&type=' . $type;
$edit = COM_createLink($LANG01[4], $editlink) . ' | ';
}
// unsubscribe link
$unsubscribe = '';
if ($_CONF['allow_reply_notifications'] == 1 && !COM_isAnonUser() && isset($A['uid']) && isset($_USER['uid']) && $_USER['uid'] == $A['uid']) {
$hash = DB_getItem($_TABLES['commentnotifications'], 'deletehash', "cid = {$A['cid']} AND uid = {$_USER['uid']}");
if (!empty($hash)) {
$unsublink = $_CONF['site_url'] . '/comment.php?mode=unsubscribe&key=' . $hash;
$unsubattr = array('title' => $LANG03[43]);
$unsubscribe = COM_createLink($LANG03[42], $unsublink, $unsubattr) . ' | ';
}
}
// if deletion is allowed, displays delete link
if ($delete_option) {
$deloption = '';
// always place edit option first, if available
if (!empty($edit)) {
$deloption .= $edit;
}
// actual delete option
$dellink = $_CONF['site_url'] . '/comment.php?mode=delete&cid=' . $A['cid'] . '&sid=' . $A['sid'] . '&type=' . $type . '&' . CSRF_TOKEN . '=' . $token;
$delattr = array('onclick' => "return confirm('{$MESSAGE[76]}');");
$deloption .= COM_createLink($LANG01[28], $dellink, $delattr) . ' | ';
if (!empty($A['ipaddress'])) {
if (empty($_CONF['ip_lookup'])) {
$deloption .= $A['ipaddress'] . ' | ';
} else {
$iplookup = str_replace('*', $A['ipaddress'], $_CONF['ip_lookup']);
$deloption .= COM_createLink($A['ipaddress'], $iplookup) . ' | ';
}
}
if (!empty($unsubscribe)) {
$deloption .= $unsubscribe;
}
$template->set_var('delete_option', $deloption);
} elseif ($edit_option) {
$template->set_var('delete_option', $edit . $unsubscribe);
} elseif (!COM_isAnonUser()) {
$reportthis = '';
if ($A['uid'] != $_USER['uid']) {
$reportthis_link = $_CONF['site_url'] . '/comment.php?mode=report&cid=' . $A['cid'] . '&type=' . $type;
$report_attr = array('title' => $LANG01[110]);
$reportthis = COM_createLink($LANG01[109], $reportthis_link, $report_attr) . ' | ';
}
$template->set_var('delete_option', $reportthis . $unsubscribe);
} else {
$template->set_var('delete_option', '');
}
//and finally: format the actual text of the comment, but check only the text, not sig or edit
$text = str_replace('<!-- COMMENTSIG --><div class="comment-sig">', '', $A['comment']);
$text = str_replace('</div><!-- /COMMENTSIG -->', '', $text);
$text = str_replace('<div class="comment-edit">', '', $text);
$text = str_replace('</div><!-- /COMMENTEDIT -->', '', $text);
if (preg_match('/<.*>/', $text) == 0) {
$A['comment'] = nl2br($A['comment']);
}
// highlight search terms if specified
if (!empty($_REQUEST['query'])) {
$A['comment'] = COM_highlightQuery($A['comment'], $_REQUEST['query']);
}
$A['comment'] = str_replace('$', '$', $A['comment']);
$A['comment'] = str_replace('{', '{', $A['comment']);
$A['comment'] = str_replace('}', '}', $A['comment']);
// Replace any plugin autolink tags
$A['comment'] = PLG_replaceTags($A['comment']);
// create a reply to link
$reply_link = '';
if ($ccode == 0) {
$reply_link = $_CONF['site_url'] . '/comment.php?sid=' . $A['sid'] . '&pid=' . $A['cid'] . '&title=' . urlencode($A['title']) . '&type=' . $A['type'];
$reply_option = COM_createLink($LANG01[43], $reply_link, array('rel' => 'nofollow')) . ' | ';
$template->set_var('reply_option', $reply_option);
} else {
$template->set_var('reply_option', '');
}
$template->set_var('reply_link', $reply_link);
// format title for display, must happen after reply_link is created
$A['title'] = htmlspecialchars($A['title']);
$A['title'] = str_replace('$', '$', $A['title']);
$template->set_var('title', $A['title']);
$template->set_var('comments', $A['comment']);
// parse the templates
if ($mode == 'threaded' && $indent > 0) {
$template->set_var('pid', $A['pid']);
$retval .= $template->parse('output', 'thread');
} else {
$template->set_var('pid', $A['cid']);
$retval .= $template->parse('output', 'comment');
}
$row++;
} while ($A = DB_fetchArray($comments));
return $retval;
}
作者:matrox6
项目:evlis
/**
* Create a list of events
*
* @param integer $range Range indicator (upcoming, past, etc)
* @param integer $category Category to limit search
* @param string $block_title Title of block
* @return string HTML for list page
*/
function EVLIST_listview($range = '', $category = '', $calendar = '', $block_title = '')
{
global $_CONF, $_EV_CONF, $_USER, $_TABLES, $LANG_EVLIST;
EVLIST_setViewSession('list', $year, $month, $day);
$retval = '';
$T = new Template(EVLIST_PI_PATH . '/templates/');
$T->set_file('index', 'index.thtml');
if ($_EV_CONF['_can_add']) {
$add_event_link = EVLIST_URL . '/event.php?edit=x';
} else {
$add_event_link = '';
}
$T->set_var(array('action' => EVLIST_URL . '/index.php', 'range_options' => EVLIST_GetOptions($LANG_EVLIST['ranges'], $range), 'add_event_link' => $add_event_link, 'add_event_text' => $LANG_EVLIST['add_event'], 'rangetext' => $LANG_EVLIST['ranges'][$range]));
$page = empty($_GET['page']) ? 1 : (int) $_GET['page'];
$opts = array('cat' => $category, 'page' => $page, 'limit' => $_EV_CONF['limit_list'], 'cal' => $calendar);
switch ($range) {
case 1:
// past
$start = EV_MIN_DATE;
$end = $_EV_CONF['_today'];
$opts['order'] = 'DESC';
break;
case 3:
//this week
$start = $_EV_CONF['_today'];
$end = date('Y-m-d', strtotime('+1 week', $_EV_CONF['_today_ts']));
break;
case 4:
//this month
$start = $_EV_CONF['_today'];
$end = date('Y-m-d', strtotime('+1 month', $_EV_CONF['_today_ts']));
break;
case 2:
//upcoming
//upcoming
default:
$start = $_EV_CONF['_today'];
$end = EV_MAX_DATE;
break;
}
$events = EVLIST_getEvents($start, $end, $opts);
if (empty($events)) {
//return empty list msg
$T->set_var(array('title' => '', 'block_title' => $block_title, 'empty_listmsg' => $LANG_EVLIST['no_match']));
if (!empty($range)) {
$andrange = '&range=' . $range;
$T->set_var('range', $range);
} else {
$andrange = '&range=2';
}
if (!empty($category)) {
$andcat = '&cat=' . $category;
$T->set_var('category', $category);
} else {
$andcat = '';
}
} else {
//populate list
// So we don't call SEC_hasRights inside the loop
$isAdmin = SEC_hasRights('evlist.admin');
$T->set_file(array('item' => 'list_item.thtml', 'editlinks' => 'edit_links.thtml', 'category_form' => 'category_dd.thtml'));
if (!empty($range)) {
$andrange = '&range=' . $range;
$T->set_var('range', $range);
} else {
$andrange = '&range=2';
}
if (!empty($category)) {
$andcat = '&cat=' . $category;
$T->set_var('category', $category);
} else {
$andcat = '';
}
// Track events that have been shown so we show them only once.
$already_shown = array();
foreach ($events as $date => $daydata) {
foreach ($daydata as $A) {
if (array_key_exists($A['rp_id'], $already_shown)) {
continue;
} else {
$already_shown[$A['rp_id']] = 1;
}
$titlelink = COM_buildURL(EVLIST_URL . '/event.php?eid=' . $A['rp_id'] . $timestamp . $andrange . $andcat);
$titlelink = '<a href="' . $titlelink . '">' . COM_stripslashes($A['title']) . '</a>';
$summary = PLG_replaceTags(COM_stripslashes($A['summary']));
$datesummary = sprintf($LANG_EVLIST['event_begins'], EVLIST_formattedDate(strtotime($A['rp_date_start'])));
$morelink = COM_buildURL(EVLIST_URL . '/event.php?eid=' . $A['rp_id'] . $timestamp . $andrange . $andcat);
$morelink = '<a href="' . $morelink . '">' . $LANG_EVLIST['read_more'] . '</a>';
if (empty($A['email'])) {
$contactlink = $_CONF['site_url'] . '/profiles.php?uid=' . $A['owner_id'];
} else {
$contactlink = 'mailto:' . EVLIST_obfuscate($A['email']);
//.........这里部分代码省略.........
作者:milk5
项目:geeklog-japa
/**
* Saves link to the database
*
* @param string $lid ID for link
* @param string $old_lid old ID for link
* @param string $cid cid of category link belongs to
* @param string $categorydd Category links belong to
* @param string $url URL of link to save
* @param string $description Description of link
* @param string $title Title of link
* @param int $hits Number of hits for link
* @param int $owner_id ID of owner
* @param int $group_id ID of group link belongs to
* @param int $perm_owner Permissions the owner has
* @param int $perm_group Permissions the group has
* @param int $perm_members Permissions members have
* @param int $perm_anon Permissions anonymous users have
* @return string HTML redirect or error message
* @global array core config vars
* @global array core group data
* @global array core table data
* @global array core user data
* @global array core msg data
* @global array links plugin lang admin vars
*
*/
function savelink($lid, $old_lid, $cid, $categorydd, $url, $description, $title, $hits, $owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon)
{
global $_CONF, $_GROUPS, $_TABLES, $_USER, $MESSAGE, $LANG_LINKS_ADMIN, $_LI_CONF;
$retval = '';
// Convert array values to numeric permission values
if (is_array($perm_owner) or is_array($perm_group) or is_array($perm_members) or is_array($perm_anon)) {
list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($perm_owner, $perm_group, $perm_members, $perm_anon);
}
// Remove any autotags the user doesn't have permission to use
$description = PLG_replaceTags($description, '', true);
// clean 'em up
$description = DB_escapeString(COM_checkHTML(COM_checkWords($description), 'links.edit'));
$title = DB_escapeString(strip_tags(COM_checkWords($title)));
$cid = DB_escapeString($cid);
if (empty($owner_id)) {
// this is new link from admin, set default values
$owner_id = $_USER['uid'];
if (isset($_GROUPS['Links Admin'])) {
$group_id = $_GROUPS['Links Admin'];
} else {
$group_id = SEC_getFeatureGroup('links.edit');
}
$perm_owner = 3;
$perm_group = 2;
$perm_members = 2;
$perm_anon = 2;
}
$lid = COM_sanitizeID($lid);
$old_lid = COM_sanitizeID($old_lid);
if (empty($lid)) {
if (empty($old_lid)) {
$lid = COM_makeSid();
} else {
$lid = $old_lid;
}
}
// check for link id change
if (!empty($old_lid) && $lid != $old_lid) {
// check if new lid is already in use
if (DB_count($_TABLES['links'], 'lid', $lid) > 0) {
// TBD: abort, display editor with all content intact again
$lid = $old_lid;
// for now ...
}
}
$access = 0;
$old_lid = DB_escapeString($old_lid);
if (DB_count($_TABLES['links'], 'lid', $old_lid) > 0) {
$result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['links']} WHERE lid = '{$old_lid}'");
$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']);
} else {
$access = SEC_hasAccess($owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon);
}
if ($access < 3 || !SEC_inGroup($group_id)) {
$display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
COM_accessLog("User {$_USER['username']} tried to illegally submit or edit link {$lid}.");
COM_output($display);
exit;
} elseif (!empty($title) && !empty($description) && !empty($url)) {
if ($categorydd != $LANG_LINKS_ADMIN[7] && !empty($categorydd)) {
$cid = DB_escapeString($categorydd);
} else {
if ($categorydd != $LANG_LINKS_ADMIN[7]) {
echo COM_refresh($_CONF['site_admin_url'] . '/plugins/links/index.php');
}
}
DB_delete($_TABLES['linksubmission'], 'lid', $old_lid);
DB_delete($_TABLES['links'], 'lid', $old_lid);
DB_save($_TABLES['links'], 'lid,cid,url,description,title,date,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon', "'{$lid}','{$cid}','{$url}','{$description}','{$title}',NOW(),'{$hits}',{$owner_id},{$group_id},{$perm_owner},{$perm_group},{$perm_members},{$perm_anon}");
if (empty($old_lid) || $old_lid == $lid) {
PLG_itemSaved($lid, 'links');
} else {
//.........这里部分代码省略.........
作者:JohnTor
项目:paypa
/**
* Display the detail page for the product.
*
* @return string HTML for the product page.
*/
public function Detail()
{
global $_CONF, $_PP_CONF, $_TABLES, $LANG_PP, $_USER, $_SYSTEM;
USES_lib_comments();
$prod_id = $this->id;
if ($prod_id < 1 || !$this->enabled || !$this->isAvailable()) {
return PAYPAL_errorMessage($LANG_PP['invalid_product_id'], 'info');
}
$retval = COM_startBlock();
// Set the template dir based on the configured template version
$tpl_dir = PAYPAL_PI_PATH . '/templates/detail/' . $_PP_CONF['product_tpl_ver'];
$T = new Template($tpl_dir);
$T->set_file('product', 'product_detail_attrib.thtml');
$name = $this->name;
$l_desc = PLG_replaceTags($this->description);
$s_desc = PLG_replaceTags($this->short_description);
// Highlight the query terms if coming from a search
if (isset($_REQUEST['query']) && !empty($_REQUEST['query'])) {
$name = COM_highlightQuery($name, $_REQUEST['query']);
$l_desc = COM_highlightQuery($l_desc, $_REQUEST['query']);
$s_desc = COM_highlightQuery($s_desc, $_REQUEST['query']);
}
$onsale = $this->isOnSale();
$act_price = $onsale ? $this->sale_price : $this->price;
$qty_disc_txt = '';
foreach ($this->qty_discounts as $qty => $pct) {
$qty_disc_txt .= sprintf('Buy %d, save %.02f%%<br />', $qty, $pct);
}
// Get custom text input fields
if ('' != $this->custom) {
$T->set_block('product', 'CustAttrib', 'cAttr');
$text_field_names = explode('|', $this->custom);
foreach ($text_field_names as $id => $text_field_name) {
$T->set_var(array('fld_id' => "cust_text_fld_{$id}", 'fld_name' => htmlspecialchars($text_field_name)));
$T->parse('cAttr', 'CustAttrib', true);
}
}
$T->set_var(array('is_uikit' => $_SYSTEM['framework'] == 'uikit' ? 'true' : '', 'have_attributes' => $this->hasAttributes(), 'id' => $prod_id, 'name' => $name, 'short_description' => $s_desc, 'description' => $l_desc, 'cur_decimals' => $this->currency->Decimals(), 'price' => $this->currency->FormatValue($act_price), 'orig_price' => $this->currency->Format($this->price), 'on_sale' => $onsale ? 'true' : '', 'img_cell_width' => $_PP_CONF['max_thumb_size'] + 20, 'price_prefix' => $this->currency->Pre(), 'price_postfix' => $this->currency->Post(), 'onhand' => $this->track_onhand ? $this->onhand : '', 'qty_disc' => $qty_disc_txt));
// Retrieve the photos and put into the template
$sql = "SELECT img_id, filename\n FROM {$_TABLES['paypal.images']} \n WHERE product_id='{$prod_id}'";
//echo $sql;die;
$img_res = DB_query($sql);
$photo_detail = '';
$T->set_var('have_photo', '');
// assume no photo available
if ($img_res && DB_numRows($img_res) > 0) {
for ($i = 0; $prow = DB_fetchArray($img_res, false); $i++) {
if ($prow['filename'] != '' && file_exists("{$_PP_CONF['image_dir']}/{$prow['filename']}")) {
if ($i == 0) {
$T->set_var('main_img', PAYPAL_ImageUrl($prow['filename'], $tpl_config['lg_img_width'] - 20, $tpl_config['lg_img_height'] - 20));
}
$T->set_block('product', 'Thumbnail', 'PBlock');
$T->set_var(array('img_file' => $prow['filename'], 'disp_img' => PAYPAL_ImageUrl($prow['filename'], $tpl_config['lg_img_width'] - 20, $tpl_config['lg_img_height'] - 20), 'lg_img' => PAYPAL_URL . '/images/products/' . $prow['filename'], 'img_url' => PAYPAL_URL . '/images/products', 'thumb_url' => PAYPAL_ImageUrl($prow['filename']), 'tn_width' => $_PP_CONF['max_thumb_size'], 'tn_height' => $_PP_CONF['max_thumb_size']));
$T->parse('PBlock', 'Thumbnail', true);
}
}
}
// Get the product options, if any, and set them into the form
$cbrk = '';
$T->set_block('product', 'AttrSelect', 'attrSel');
foreach ($this->options as $id => $Attr) {
/*if ($Attr['attr_value'] === '') {
$type = 'text';
} else {
$type = 'select';
}*/
$type = 'select';
if ($Attr['attr_name'] != $cbrk) {
if ($cbrk != '') {
// end block if not the first element
$T->set_var(array('attr_name' => $cbrk, 'attr_options' => $attributes, 'opt_id' => $id));
$T->parse('attrSel', 'AttrSelect', true);
}
$cbrk = $Attr['attr_name'];
$attributes = '';
}
if ($type == 'select') {
if ($Attr['attr_price'] != 0) {
$attr_str = sprintf(" ( %+.2f )", $Attr['attr_price']);
} else {
$attr_str = '';
}
$attributes .= '<option value="' . $id . '|' . $Attr['attr_value'] . '|' . $Attr['attr_price'] . '">' . $Attr['attr_value'] . $attr_str . '</option>' . LB;
/*} else {
$attributes .= "<input type=\"hidden\" name=\"on{$i}\"
value=\"{$Attr['attr_name']}\">\n";
$attributes .= $Attr['attr_name'] . ':</td>
<td><input class="uk-contrast uk-form" type"text" name="os' . $i. '" value="" size="32" /></td></tr>';
*/
}
}
if ($cbrk != '') {
// finish off the last selection
$T->set_var(array('attr_name' => $cbrk, 'attr_options' => $attributes, 'opt_id' => $id));
$T->parse('attrSel', 'AttrSelect', true);
//.........这里部分代码省略.........
作者:ivyw
项目:foru
//.........这里部分代码省略.........
}
if ($userarray['email'] != '' && $showtopic["uid"] > 1) {
$email_link = "{$_CONF['site_url']}/profiles.php?uid={$showtopic['uid']}";
$email_linktext = $LANG_GF09['email'];
$topictemplate->set_var('emaillink', $email_link);
$topictemplate->set_var('emaillinktext', $email_linktext);
$topictemplate->set_var('LANG_email', $LANG_GF01['EmailLink']);
$topictemplate->parse('email_link', 'email_link');
}
if ($userarray['homepage'] != '') {
$homepage = trim($userarray['homepage']);
if (strtolower(substr($homepage, 0, 4)) != 'http') {
$homepage = 'http://' . $homepage;
}
$homepagetext = $LANG_GF09['website'];
$topictemplate->set_var('websitelink', $homepage);
$topictemplate->set_var('websitelinktext', $homepagetext);
$topictemplate->set_var('LANG_website', $LANG_GF01['WebsiteLink']);
$topictemplate->parse('website_link', 'website_link');
}
if ($userarray['location'] != '' && $showtopic["uid"] > 1) {
$topictemplate->set_var('user_location', $userarray['location']);
$topictemplate->parse('location', 'location');
}
} else {
if (isset($_GET['onlytopic']) and $_GET['onlytopic'] != 1) {
$topictemplate->set_var('posted_date', '');
$topictemplate->set_var('preview_topic_subject', $showtopic['subject']);
} else {
$topictemplate->set_var('preview_topic_subject', '');
}
$topictemplate->set_var('read_msg', '');
$topictemplate->set_var('topiclocked_icon', '');
$topictemplate->set_var('preview_mode', 'none');
}
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time4: $intervalTime");
$showtopic['comment'] = str_replace('{', '{', $showtopic['comment']);
$showtopic['comment'] = str_replace('}', '}', $showtopic['comment']);
// Temporary correspondence. You should cope in more roots.
$showtopic['comment'] = str_replace(array("<br />", "<br>"), '<br' . XHTML . '>', $showtopic['comment']);
$topictemplate->set_var('layout_url', $CONF_FORUM['layout_url']);
$topictemplate->set_var('csscode', $onetwo);
$topictemplate->set_var('postmode', $showtopic['postmode']);
$topictemplate->set_var('userlink', $userlink);
$topictemplate->set_var('lang_forum', $LANG_GF01['FORUM']);
$topictemplate->set_var('user_levelname', $user_levelname);
$topictemplate->set_var('user_level', $user_level);
$topictemplate->set_var('avatar', $avatar);
$topictemplate->set_var('regdate', $regdate);
$topictemplate->set_var('numposts', $numposts);
if (forum_modPermission($showtopic['forum'], $_USER['uid'], 'mod_ban')) {
$topictemplate->set_var('ip', $showtopic['ip']);
if ($showtopic['uid'] == 1) {
$topictemplate->parse('ip_address', 'anon_ip_address');
} else {
$topictemplate->parse('ip_address', 'ip_address');
}
} else {
$topictemplate->set_var('ip_address', '');
}
$topictemplate->set_var('imgset', $CONF_FORUM['imgset']);
$topictemplate->set_var('topic_subject', $showtopic['subject']);
$topictemplate->set_var('LANG_ON2', $LANG_GF01['ON2']);
if ($mode != 'preview') {
$mod_functions = forum_getmodFunctions($showtopic);
if (!empty($mod_functions)) {
$topictemplate->set_var('mod_functions', $mod_functions);
$topictemplate->parse('mod_functions', 'mod_functions');
} else {
$topictemplate->set_var('mod_functions', '');
}
}
$topictemplate->set_var('topic_comment', $showtopic['comment']);
$topictemplate->set_var('comment_minheight', "min-height:{$min_height}px");
if (trim($sig) != '') {
$topictemplate->set_var('sig', PLG_replaceTags($sig));
$topictemplate->set_var('show_sig', '');
$topictemplate->parse('user_signature', 'user_signature');
} else {
$topictemplate->set_var('sig', '');
$topictemplate->set_var('show_sig', 'none');
$topictemplate->set_var('user_signature', '');
}
$topictemplate->set_var('forumid', $showtopic['forum']);
$topictemplate->set_var('topic_id', $showtopic['id']);
$topictemplate->set_var('member_badge', forumPLG_getMemberBadge($showtopic['uid']));
if ($uservalid) {
$topictemplate->parse('user_name', 'block_user_name');
$topictemplate->parse('user_information', 'block_user_information');
} else {
$topictemplate->parse('user_name', 'block_anon_user_name');
$topictemplate->parse('user_information', 'block_anon_user_information');
}
$topictemplate->parse('output', 'topictemplate');
$retval = $topictemplate->finish($topictemplate->get_var('output'));
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time5: $intervalTime");
return $retval;
}
作者:NewRout
项目:evlis
/**
* Display the detail page for the event occurrence.
*
* @param integer $rp_id ID of the repeat to display
* @param string $query Optional query string, for highlighting
* @param string $tpl Optional template filename, e.g. 'event_print'
* @return string HTML for the page.
*/
public function Render($rp_id = 0, $query = '', $tpl = '')
{
global $_CONF, $_USER, $_EV_CONF, $_TABLES, $LANG_EVLIST, $LANG_WEEK, $_SYSTEM;
$retval = '';
$url = '';
$location = '';
$street = '';
$city = '';
$province = '';
$country = '';
$postal = '';
$name = '';
$email = '';
$phone = '';
if ($rp_id != 0) {
$this->Read($rp_id);
}
if ($this->rp_id == 0) {
return EVLIST_alertMessage($LANG_EVLIST['access_denied']);
}
//update hit count
evlist_hit($this->ev_id);
$template = 'event';
if (!empty($tpl)) {
$template .= '_' . $tpl;
} else {
$template .= $_SYSTEM['framework'] == 'uikit' ? '.uikit' : '';
}
$T = new Template(EVLIST_PI_PATH . '/templates/');
$T->set_file(array('event' => $template . '.thtml', 'datetime' => 'date_time.thtml', 'address' => 'address.thtml', 'contact' => 'contact.thtml'));
// If plain text then replace newlines with <br> tags
if ($this->Event->postmode == '1') {
//plaintext
$this->Event->Detail->summary = nl2br($this->Event->Detail->summary);
$this->Event->Detail->full_description = nl2br($this->Event->Detail->full_description);
$this->Event->Detail->location = nl2br($this->Event->Detail->location);
}
$title = $this->Event->Detail->title;
if ($this->postmode != 'plaintext') {
$summary = PLG_replaceTags($this->Event->Detail->summary);
$fulldescription = PLG_replaceTags($this->Event->Detail->full_description);
$location = $this->Event->Detail->location != '' ? PLG_replaceTags($this->Event->Detail->location) : '';
} else {
$summary = $this->Event->Detail->summary;
$fulldescription = $this->Event->Detail->full_description;
$location = $this->Event->Detail->location;
}
if ($query != '') {
$title = COM_highlightQuery($title, $query);
if (!empty($summary)) {
$summary = COM_highlightQuery($summary, $query);
}
if (!empty($fulldescription)) {
$fulldescription = COM_highlightQuery($fulldescription, $query);
}
if (!empty($location)) {
$location = COM_highlightQuery($location, $query);
}
}
$date_start = EVLIST_formattedDate($this->date_start);
if ($this->date_start != $this->date_end) {
$date_end = EVLIST_formattedDate($this->date_end);
} else {
$date_end = '';
}
if ($this->Event->allday == '1') {
$allday = '<br />' . $LANG_EVLIST['all_day_event'];
} else {
$allday = '';
if ($this->time_start1 != '') {
$time_start1 = EVLIST_formattedTime($this->time_start1);
$time_end1 = EVLIST_formattedTime($this->time_end1);
} else {
$time_start1 = '';
$time_end1 = '';
}
//$time_period = $time_start . $time_end;
if ($this->Event->split == '1') {
$time_start2 = EVLIST_formattedTime($this->time_start2);
$time_end2 = EVLIST_formattedTime($this->time_end2);
}
}
$url = $this->Event->Detail->url;
$street = $this->Event->Detail->street;
$city = $this->Event->Detail->city;
$province = $this->Event->Detail->province;
$postal = $this->Event->Detail->postal;
$country = $this->Event->Detail->country;
// Now get the text description of the recurring interval, if any
if ($this->Event->recurring && $this->Event->rec_data['type'] < EV_RECUR_DATES) {
$rec_data = $this->Event->rec_data;
$rec_string = $LANG_EVLIST['recur_freq_txt'] . ' ' . $this->Event->RecurDescrip();
//.........这里部分代码省略.........
作者:ivyw
项目:geeklo
//.........这里部分代码省略.........
$allow_autotags = 0;
}
if ($cache_time < -1 or $cache_time == "") {
$cache_time = $_CONF['default_cache_time_block'];
}
if ($type == 'portal') {
$content = '';
$rdfupdated = '';
$phpblockfn = '';
// get rid of possible extra prefixes (e.g. "feed://http://...")
if (substr($rdfurl, 0, 4) == 'rss:') {
$rdfurl = substr($rdfurl, 4);
} elseif (substr($rdfurl, 0, 5) == 'feed:') {
$rdfurl = substr($rdfurl, 5);
}
if (substr($rdfurl, 0, 2) == '//') {
$rdfurl = substr($rdfurl, 2);
}
$rdfurl = COM_sanitizeUrl($rdfurl, array('http', 'https'));
}
if ($type == 'gldefault') {
$content = '';
$rdfurl = '';
$rdfupdated = '';
$rdflimit = 0;
$phpblockfn = '';
}
if ($type == 'phpblock') {
// NOTE: PHP Blocks must be within a function and the function
// must start with phpblock_ as the prefix. This will prevent
// the arbitrary execution of code
if (!stristr($phpblockfn, 'phpblock_')) {
$retval .= COM_showMessageText($LANG21[38], $LANG21[37]) . editblock($bid);
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG21[37]));
return $retval;
}
$content = '';
$rdfurl = '';
$rdfupdated = '';
$rdflimit = 0;
}
if ($type == 'normal') {
$rdfurl = '';
$rdfupdated = '';
$rdflimit = 0;
$phpblockfn = '';
if ($allow_autotags == 1) {
// Remove any autotags the user doesn't have permission to use
$content = PLG_replaceTags($content, '', true);
}
$content = DB_escapeString($content);
}
if ($rdflimit < 0) {
$rdflimit = 0;
}
if (!empty($rdfurl)) {
$rdfurl = DB_escapeString($rdfurl);
}
if (empty($rdfupdated)) {
$rdfupdated = '0000-00-00 00:00:00';
}
if ($bid > 0) {
DB_save($_TABLES['blocks'], 'bid,name,title,help,type,blockorder,content,rdfurl,rdfupdated,rdflimit,phpblockfn,onleft,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,is_enabled,allow_autotags,cache_time,rdf_last_modified,rdf_etag', "{$bid},'{$name}','{$title}','{$help}','{$type}','{$blockorder}','{$content}','{$rdfurl}','{$rdfupdated}','{$rdflimit}','{$phpblockfn}',{$onleft},{$owner_id},{$group_id},{$perm_owner},{$perm_group},{$perm_members},{$perm_anon},{$is_enabled},{$allow_autotags},{$cache_time},NULL,NULL");
} else {
$sql = array();
$sql['mysql'] = $sql['mssql'] = "INSERT INTO {$_TABLES['blocks']} " . '(name,title,help,type,blockorder,content,rdfurl,rdfupdated,rdflimit,phpblockfn,onleft,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,is_enabled,allow_autotags,cache_time) ' . "VALUES ('{$name}','{$title}','{$help}','{$type}','{$blockorder}','{$content}','{$rdfurl}','{$rdfupdated}','{$rdflimit}','{$phpblockfn}',{$onleft},{$owner_id},{$group_id},{$perm_owner},{$perm_group},{$perm_members},{$perm_anon},{$is_enabled},{$allow_autotags},{$cache_time})";
$sql['pgsql'] = "INSERT INTO {$_TABLES['blocks']} " . '(bid,name,title,help,type,blockorder,content,rdfurl,rdfupdated,rdflimit,phpblockfn,onleft,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,is_enabled,allow_autotags,cache_time) ' . "VALUES ((SELECT NEXTVAL('{$_TABLES['blocks']}_bid_seq')),'{$name}','{$title}','{$help}','{$type}','{$blockorder}','{$content}','{$rdfurl}','1970-01-01','{$rdflimit}','{$phpblockfn}',{$onleft},{$owner_id},{$group_id},{$perm_owner},{$perm_group},{$perm_members},{$perm_anon},{$is_enabled},{$allow_autotags},{$cache_time})";
DB_query($sql);
$bid = DB_insertId();
}
TOPIC_saveTopicSelectionControl('block', $bid);
$cacheInstance = 'block__' . $bid . '__';
// remove any of this blocks instances if exists
CACHE_remove_instance($cacheInstance);
return COM_refresh($_CONF['site_admin_url'] . '/block.php?msg=11');
} else {
if (empty($name)) {
// empty block name
$msgtxt = $LANG21[50];
} elseif ($type == 'portal') {
// Portal block is missing fields
$msgtxt = $LANG21[33];
} elseif ($type == 'phpblock') {
// PHP Block is missing field
$msgtxt = $LANG21[34];
} elseif ($type == 'normal') {
// Normal block is missing field
$msgtxt = $LANG21[35];
} elseif ($type == 'gldefault') {
// Default geeklog field missing
$msgtxt = $LANG21[42];
} else {
// Layout block missing content
$msgtxt = $LANG21[36];
}
$retval .= COM_showMessageText($msgtxt, $LANG21[32]) . editblock($bid);
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG21[32]));
}
return $retval;
}
作者:NewRout
项目:glfusio
if ($total_print_pages == 0) {
$total_print_pages = 1;
}
//$T = new Template($_CONF['path_html'] . $mb_base_path . '/templates');
$T = new Template($_CONF['path'] . 'plugins/ckeditor/templates/mediagallery');
$T->set_file(array('page' => 'mb.thtml', 'body' => 'mb_body.thtml'));
$birdseed = $MG_albums[$album_id]->getPath(0, '');
$refresh = isset($_REQUEST['refresh']) ? COM_applyFilter($_REQUEST['refresh'], true) : 0;
if ($refresh != 1) {
// initial call
$T->set_var(array('border_yes' => $_mgMB_CONF['at_border'] == 1 ? ' selected="selected"' : '', 'border_no' => $_mgMB_CONF['at_border'] == 1 ? '' : ' selected="selected"', 'algin_none' => $_mgMB_CONF['at_align'] == 'none' ? ' selected="selected"' : '', 'align_auto' => $_mgMB_CONF['at_align'] == 'auto' ? ' selected="selected"' : '', 'align_right' => $_mgMB_CONF['at_align'] == 'right' ? ' selected="selected"' : '', 'align_left' => $_mgMB_CONF['at_align'] == 'left' ? ' selected="selected"' : '', 'width' => $_mgMB_CONF['at_width'], 'height' => $_mgMB_CONF['at_height'], 'delay' => $_mgMB_CONF['at_delay'], 'src_tn' => $_mgMB_CONF['at_src'] == 'tn' ? ' selected="selected"' : '', 'src_disp' => $_mgMB_CONF['at_src'] == 'disp' ? ' selected="selected"' : '', 'src_orig' => $_mgMB_CONF['at_src'] == 'orig' ? ' selected="selected"' : '', 'autoplay_yes' => $_mgMB_CONF['at_autoplay'] == 1 ? ' selected="selected"' : '', 'autoplay_no' => $_mgMB_CONF['at_autoplay'] == 1 ? '' : ' selected="selected"', 'link_yes' => $_mgMB_CONF['at_enable_link'] == 1 ? ' selected="selected"' : '', 'link_no' => $_mgMB_CONF['at_enable_link'] == 1 ? '' : ' selected="selected"', 'alturl_no' => isset($_mgMB_CONF['at_alt_url']) && $_mgMB_CONF['at_alt_url'] == 1 ? '' : ' selected="selected"', 'alturl_yes' => isset($_mgMB_CONF['at_alt_url']) && $_mgMB_CONF['at_alt_url'] == 1 ? ' selected="selected"' : ''));
} else {
$T->set_var(array('border_yes' => $_POST['border'] == 1 ? ' selected="selected"' : '', 'border_no' => $_POST['border'] == 1 ? '' : ' selected="selected"', 'align_none' => $_POST['alignment'] == 'none' ? ' selected="selected"' : '', 'align_auto' => $_POST['alignment'] == 'auto' ? ' selected="selected"' : '', 'align_right' => $_POST['alignment'] == 'right' ? ' selected="selected"' : '', 'align_left' => $_POST['alignment'] == 'left' ? ' selected="selected"' : '', 'width' => $_POST['width'], 'height' => $_POST['height'], 'delay' => isset($_POST['delay']) ? $_POST['delay'] : $_mgMB_CONF['at_delay'], 'src_tn' => $_POST['source'] == 'tn' ? ' selected="selected"' : '', 'src_disp' => $_POST['source'] == 'disp' ? ' selected="selected"' : '', 'src_orig' => $_POST['source'] == 'orig' ? ' selected="selected"' : '', 'autoplay_yes' => $_POST['autoplay'] == 1 ? ' selected="selected"' : '', 'autoplay_no' => $_POST['autoplay'] == 1 ? '' : ' selected="selected"', 'link_yes' => $_POST['link'] == 1 ? ' selected="selected"' : '', 'link_no' => $_POST['link'] == 1 ? '' : ' selected="selected"', 'alturl_yes' => $_POST['alturl'] == 1 ? ' selected="selected"' : '', 'alturl_no' => $_POST['alturl'] == 1 ? '' : ' selected="selected"', 'albumon' => $_POST['autotag'] == 'album' ? ' checked=checked' : '', 'slideshowon' => $_POST['autotag'] == 'slideshow' ? ' checked=checked' : '', 'fslideshowon' => $_POST['autotag'] == 'fslideshow' ? ' checked=checked' : '', 'mediaon' => $_POST['autotag'] == 'media' ? ' checked=checked' : '', 'mlinkon' => $_POST['autotag'] == 'mlink' ? ' checked=checked' : '', 'imgon' => $_POST['autotag'] == 'img' ? ' checked=checked' : '', 'videoon' => $_POST['autotag'] == 'video' ? ' checked=checked' : '', 'audioon' => $_POST['autotag'] == 'audio' ? 'checked=checked' : '', 'playallon' => $_POST['autotag'] == 'playall' ? 'checked=checked' : '', 'caption' => $_POST['caption']));
}
$self_url = @htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, COM_getEncodingt());
$T->set_var(array('s_form_action' => $self_url, 'site_url' => $_MG_CONF['site_url'], 'birdseed' => $birdseed, 'album_title' => PLG_replaceTags($MG_albums[$album_id]->title), 'table_columns' => $columns_per_page, 'table_column_width' => intval(100 / $columns_per_page) . '%', 'top_pagination' => COM_printPageNavigation($self_url . '?aid=' . $album_id . '&i=' . $instance . '&refresh=1', $page + 1, ceil($total_items_in_album / $media_per_page)), 'bottom_pagination' => COM_printPageNavigation($self_url . '?aid=' . $album_id . '&i=' . $instance . '&refresh=1', $page + 1, ceil($total_items_in_album / $media_per_page)), 'page_number' => sprintf("%s %d %s %d", $LANG_MG03['page'], $current_print_page, $LANG_MG03['of'], $total_print_pages), 'jumpbox' => $album_jumpbox_full, 'jumpbox_raw' => $album_jumpbox_raw, 'album_id' => $album_id, 'instance' => $instance, 'lang_menulabel' => $LANG_mgMB['menulabel'], 'lang_select_album' => $LANG_mgMB['select_album'], 'lang_go' => $LANG_mgMB['go'], 'lang_error_header' => $LANG_mgMB['error_header'], 'lang_current_album' => $LANG_mgMB['current_album'], 'lang_autotag_attr' => $LANG_mgMB['autotag_attr'], 'lang_album' => $LANG_mgMB['album'], 'lang_playall' => $LANG_mgMB['playall'], 'lang_slideshow' => $LANG_mgMB['slideshow'], 'lang_fslideshow' => $LANG_mgMB['fslideshow'], 'lang_media' => $LANG_mgMB['media'], 'lang_mlink' => $LANG_mgMB['mlink'], 'lang_img' => $LANG_mgMB['img'], 'lang_video' => $LANG_mgMB['video'], 'lang_audio' => $LANG_mgMB['audio'], 'lang_width' => $LANG_mgMB['width'], 'lang_height' => $LANG_mgMB['height'], 'lang_delay' => $LANG_mgMB['delay'], 'lang_border' => $LANG_mgMB['border'], 'lang_alignment' => $LANG_mgMB['alignment'], 'lang_source' => $LANG_mgMB['source'], 'lang_link' => $LANG_mgMB['link'], 'lang_autoplay' => $LANG_mgMB['autoplay'], 'lang_caption' => $LANG_mgMB['caption'], 'lang_thumbnails' => $LANG_mgMB['thumbnails'], 'lang_navigation' => $LANG_mgMB['navigation'], 'lang_insert' => $LANG_mgMB['insert'], 'lang_cancel' => $LANG_mgMB['cancel'], 'lang_yes' => $LANG_mgMB['yes'], 'lang_no' => $LANG_mgMB['no'], 'lang_auto' => $LANG_mgMB['auto'], 'lang_none' => $LANG_mgMB['none'], 'lang_right' => $LANG_mgMB['right'], 'lang_left' => $LANG_mgMB['left'], 'lang_thumbnail' => $LANG_mgMB['thumbnail'], 'lang_display' => $LANG_mgMB['display'], 'lang_original' => $LANG_mgMB['original'], 'lang_alturl' => $LANG_mgMB['alturl'], 'lang_ribbon' => $LANG_mgMB['ribbon'], 'lang_link_src' => $LANG_mgMB['link_src'], 'lang_showtitle' => $LANG_mgMB['showtitle'], 'lang_top' => $LANG_mgMB['top'], 'lang_bottom' => $LANG_mgMB['bottom'], 'destination' => $_mgMB_CONF['enable_dest'] == 1 ? '<p>' . $LANG_mgMB['destination'] . ' <select name="dest"><option value="story">' . $LANG_mgMB['story'] . '</option><option value="block">' . $LANG_mgMB['block'] . '</option></select>' : '', 'lang_select_album' => $LANG_mgMB['select_album']));
if ($total_media == 0) {
$T->set_var('lang_no_image', $LANG_MG03['no_media_objects']);
$T->parse('album_noimages', 'noitems');
}
if ($total_media > 0) {
$k = 0;
$T->set_block('body', 'ImageDetail', 'IDetail');
$T->set_block('body', 'ImageColumn', 'IColumn');
$T->set_block('body', 'ImageRow', 'IRow');
for ($i = 0; $i < $media_per_page; $i += $columns_per_page) {
$T->set_var('IDetail', '');
$T->set_var('IColumn', '');
for ($j = $i; $j < $i + $columns_per_page; $j++) {
if ($j >= $total_media) {
$k = $i + $columns_per_page - $j;
作者:Geeklog-Plugin
项目:paypa
$msg = $LANG_PAYPAL_1['thanks_details'];
$msg .= '<p>' . $LANG_PAYPAL_1['transaction'] . ' ' . $_POST['txn_id'] . '</p>';
$msg .= '<p>' . $LANG_PAYPAL_1['name_label'] . ' ' . $_POST['first_name'] . ' ' . $_POST['last_name'] . ' | ' . $LANG_PAYPAL_1['email'] . ' ' . $_POST['payer_email'] . '</p><ul>';
for ($i = 1; $i <= $_POST['num_cart_items']; $i++) {
$msg .= '<li>' . $_POST["quantity{$i}"] . 'x ' . $_POST["item_name{$i}"] . '... ' . $_POST["mc_gross_{$i}"] . ' ' . $_POST['mc_currency'];
}
$msg .= '</ul><p>' . $LANG_PAYPAL_1['total'] . ' ' . $_POST['mc_gross'] . ' ' . $_POST['mc_currency'] . '</p>';
$display .= COM_showMessageText($msg, $LANG_PAYPAL_1['thanks']);
$display .= '<div id="cart">' . PAYPAL_displayCart() . '</div>';
$display .= PAYPAL_siteFooter();
break;
case 'cancel':
$msg = $LANG_PAYPAL_1['cancel_details'];
$display .= COM_showMessageText($msg, $LANG_PAYPAL_1['cancel']);
$display .= PAYPAL_displayProducts('', 0, $_REQUEST['category']);
$display .= '<div id="cart">' . PAYPAL_displayCart() . '</div>';
$display .= PAYPAL_siteFooter();
break;
default:
if ($_PAY_CONF['paypal_main_header'] != '' && $_REQUEST['category'] == '') {
$display .= '<div>' . PLG_replaceTags($_PAY_CONF['paypal_main_header']) . '</div>';
}
$display .= PAYPAL_displayProducts('', 0, $_REQUEST['category']);
if ($_PAY_CONF['paypal_main_footer'] != '') {
$display .= '<div>' . PLG_replaceTags($_PAY_CONF['paypal_main_footer']) . '</div>';
}
//Display cart
$display .= '<div id="cart">' . PAYPAL_displayCart() . '</div>';
$display .= PAYPAL_siteFooter();
}
COM_output($display);
作者:ivyw
项目:geeklo
function links_save_category($cid, $old_cid, $pid, $category, $description, $tid, $owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon)
{
global $_CONF, $_TABLES, $_USER, $LANG_LINKS, $LANG_LINKS_ADMIN, $_LI_CONF, $PLG_links_MESSAGE17;
// Convert array values to numeric permission values
if (is_array($perm_owner) or is_array($perm_group) or is_array($perm_members) or is_array($perm_anon)) {
list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($perm_owner, $perm_group, $perm_members, $perm_anon);
}
// Remove any autotags the user doesn't have permission to use
$description = PLG_replaceTags($description, '', true);
// clean 'em up
$description = DB_escapeString(COM_checkHTML(COM_checkWords($description), 'links.edit'));
$category = DB_escapeString(COM_checkHTML(COM_checkWords($category), 'links.edit'));
$pid = DB_escapeString(strip_tags($pid));
$cid = DB_escapeString(strip_tags($cid));
$old_cid = DB_escapeString(strip_tags($old_cid));
if (empty($category) || empty($description)) {
return 7;
}
// Check cid to make sure not illegal
if ($cid == DB_escapeString($_LI_CONF['root']) || $cid == 'user') {
return 11;
}
if (!empty($cid) && $cid != $old_cid) {
// this is either a new category or an attempt to change the cid
// - check that cid doesn't exist yet
$ctrl = DB_getItem($_TABLES['linkcategories'], 'cid', "cid = '{$cid}'");
if (!empty($ctrl)) {
if (isset($PLG_links_MESSAGE17)) {
return 17;
} else {
return 11;
}
}
}
// Check that they didn't delete the cid. If so, get the hidden one
if (empty($cid) && !empty($old_cid)) {
$cid = $old_cid;
}
// Make sure they aren't making a parent category child of one of it's own
// children. This would create orphans
if ($cid == DB_getItem($_TABLES['linkcategories'], 'pid', "cid='{$pid}'")) {
return 12;
}
$access = 0;
if (DB_count($_TABLES['linkcategories'], 'cid', $old_cid) > 0) {
// update existing item, but new cid so get access from database with old cid
$result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['linkcategories']} WHERE cid='{$old_cid}'");
$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']);
// set flag
$update = "existing";
} else {
if (DB_count($_TABLES['linkcategories'], 'cid', $cid) > 0) {
// update existing item, same cid, so get access from database with existing cid
$result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group, perm_members,perm_anon FROM {$_TABLES['linkcategories']} WHERE cid='{$cid}'");
$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']);
// set flag
$update = "same";
} else {
// new item, so use passed values
$access = SEC_hasAccess($owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon);
// set flag
$update = 'new';
}
}
if ($access < 3) {
// no access rights: user should not be here
COM_accessLog(sprintf($LANG_LINKS_ADMIN[60], $_USER['username'], $cid));
return 6;
} else {
// save item
if ($update == 'existing') {
// update an existing item but new cid
$sql = "UPDATE {$_TABLES['linkcategories']}\n SET cid='{$cid}',\n pid='{$pid}',\n tid='{$tid}',category='{$category}',\n description='{$description}',\n modified=NOW(),\n owner_id='{$owner_id}',group_id='{$group_id}',\n perm_owner='{$perm_owner}',perm_group='{$perm_group}',\n perm_members='{$perm_members}',perm_anon='{$perm_anon}'\n WHERE cid = '{$old_cid}'";
$result = DB_query($sql);
// Also need to update links for this category
$sql = "UPDATE {$_TABLES['links']} SET cid='{$cid}' WHERE cid='{$old_cid}'";
$result = DB_query($sql);
} else {
if ($update == 'same') {
// update an existing item
$sql = "UPDATE {$_TABLES['linkcategories']}\n SET pid='{$pid}',\n tid='{$tid}',category='{$category}',\n description='{$description}',\n modified=NOW(),\n owner_id='{$owner_id}',group_id='{$group_id}',\n perm_owner='{$perm_owner}',perm_group='{$perm_group}',\n perm_members='{$perm_members}',perm_anon='{$perm_anon}'\n WHERE cid = '{$cid}'";
$result = DB_query($sql);
} else {
// insert a new item
if (empty($cid)) {
$cid = COM_makeSid();
}
$sql = "INSERT INTO {$_TABLES['linkcategories']}\n (cid, pid, category, description, tid,\n created,modified,\n owner_id, group_id, perm_owner, perm_group,\n perm_members, perm_anon)\n VALUES\n ('{$cid}','{$pid}','{$category}',\n '{$description}','{$tid}',\n NOW(),NOW(),\n '{$owner_id}','{$group_id}','{$perm_owner}',\n '{$perm_group}','{$perm_members}','{$perm_anon}')";
$result = DB_query($sql);
}
}
if ($update == 'existing' && $cid != $old_cid) {
PLG_itemSaved($cid, 'links.category', $old_cid);
} else {
PLG_itemSaved($cid, 'links.category');
}
}
return 10;
//.........这里部分代码省略.........
作者:hostelleri
项目:nexpr
//.........这里部分代码省略.........
$topictemplate->set_var('emaillink', $email_link);
$topictemplate->set_var('emaillinkimg', $email_linkimg);
$topictemplate->set_var('LANG_email', $LANG_GF01['EmailLink']);
$topictemplate->parse('email_link', 'email');
}
if ($userarray['homepage'] != '') {
$homepage = $userarray['homepage'];
if (!eregi("http", $homepage)) {
$homepage = 'http://' . $homepage;
}
$homepageimg = '<img src="' . gf_getImage('website_button') . '" border="0" align="absmiddle" alt="' . $LANG_GF01['WebsiteLink'] . '" TITLE="' . $LANG_GF01['WebsiteLink'] . '">';
$topictemplate->set_var('websitelink', $homepage);
$topictemplate->set_var('websitelinkimg', $homepageimg);
$topictemplate->set_var('LANG_website', $LANG_GF01['WebsiteLink']);
$topictemplate->parse('website_link', 'website');
}
if ($fromblock != "") {
$back2 = $LANG_GF01['back2parent'];
} else {
$back2 = $LANG_GF01['back2top'];
}
$backlink = '<center><a href="' . $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $replytopicid . '">' . $back2 . '</a></center>';
} else {
if ($_GET['onlytopic'] != 1) {
$topictemplate->set_var('posted_date', '');
$topictemplate->set_var('preview_topic_subject', $showtopic['subject']);
} else {
$topictemplate->set_var('preview_topic_subject', '');
}
$topictemplate->set_var('read_msg', '');
$topictemplate->set_var('locked_icon', '');
$topictemplate->set_var('preview_mode', 'none');
// Check and see if there are no [file] bbcode tags in content and reset the show_inline value
// This is needed in case user had used the file bbcode tag and then removed it
$imagerecs = '';
if (is_array($forumfiles)) {
$imagerecs = implode(',', $forumfiles);
}
if (!empty($_POST['uniqueid'])) {
$sql = "UPDATE {$_TABLES['gf_attachments']} SET show_inline = 0 WHERE topic_id={$_POST['uniqueid']} ";
if ($imagerecs != '') {
$sql .= "AND id NOT IN ({$imagerecs})";
}
DB_query($sql);
} else {
if (isset($_POST['id'])) {
$sql = "UPDATE {$_TABLES['gf_attachments']} SET show_inline = 0 WHERE topic_id={$_POST['id']} ";
if ($imagerecs != '') {
$sql .= "AND id NOT IN ({$imagerecs})";
}
DB_query($sql);
}
}
}
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time4: $intervalTime");
$showtopic['comment'] = str_replace('{', '{', $showtopic['comment']);
$showtopic['comment'] = str_replace('}', '}', $showtopic['comment']);
$uniqueid = COM_applyFilter($_POST['uniqueid'], true);
if ($showtopic['id'] > 0) {
$topictemplate->set_var('attachments', gf_showattachments($showtopic['id']));
} elseif ($uniqueid > 0) {
$topictemplate->set_var('attachments', gf_showattachments($uniqueid));
}
$topictemplate->set_var('layout_url', $_CONF['layout_url']);
$topictemplate->set_var('csscode', $onetwo);
$topictemplate->set_var('postmode', $showtopic['postmode']);
$topictemplate->set_var('userlink', $userlink);
$topictemplate->set_var('lang_forum', $LANG_GF01['FORUM']);
$topictemplate->set_var('user_levelname', $user_levelname);
$topictemplate->set_var('user_level', $user_level);
$topictemplate->set_var('magical_image', $moodimage);
$topictemplate->set_var('avatar', $avatar);
$topictemplate->set_var('regdate', $regdate);
$topictemplate->set_var('numposts', $numposts);
$topictemplate->set_var('location', $location);
$topictemplate->set_var('site_url', $_CONF['site_url']);
$topictemplate->set_var('imgset', $CONF_FORUM['imgset']);
$topictemplate->set_var('topic_subject', $showtopic['subject']);
$topictemplate->set_var('LANG_ON2', $LANG_GF01['ON2']);
$topictemplate->set_var('mod_functions', $mod_functions);
$topictemplate->set_var('topic_comment', $showtopic['comment']);
$topictemplate->set_var('comment_minheight', "min-height:{$min_height}px");
if (trim($sig) != '') {
$topictemplate->set_var('sig', PLG_replaceTags($sig));
$topictemplate->set_var('show_sig', '');
} else {
$topictemplate->set_var('sig', '');
$topictemplate->set_var('show_sig', 'none');
}
$topictemplate->set_var('forumid', $showtopic['forum']);
$topictemplate->set_var('topic_id', $showtopic['id']);
$topictemplate->set_var('back_link', $backlink);
$topictemplate->set_var('member_badge', forumPLG_getMemberBadge($showtopic['uid']));
$topictemplate->parse('output', 'topictemplate');
$retval .= $topictemplate->finish($topictemplate->get_var('output'));
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Show Topic Display Time5: $intervalTime");
return $retval;
}