本文整理汇总了PHP中CMT_userComments函数的典型用法代码示例。如果您正苦于以下问题:PHP CMT_userComments函数的具体用法?PHP CMT_userComments怎么用?PHP CMT_userComments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMT_userComments函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fncComment
function fncComment($id)
{
global $_CONF;
global $_TABLES;
//
$order = '';
if (isset($_REQUEST['order'])) {
$order = COM_applyFilter($_REQUEST['order']);
}
$mode = '';
if (isset($_REQUEST['mode'])) {
$mode = COM_applyFilter($_REQUEST['mode']);
}
$page = 1;
if (isset($_REQUEST['cpage'])) {
$page = COM_applyFilter($_REQUEST['cpage']);
}
//
$tbl = $_TABLES['USERBOX_base'];
//-----
$sql = "SELECT ";
$sql .= "commentcode ";
$sql .= ",owner_id";
$sql .= ",group_id";
$sql .= ",perm_owner";
$sql .= ",perm_group";
$sql .= ",perm_members";
$sql .= ",perm_anon";
$sql .= " FROM ";
$sql .= " {$tbl} AS t ";
//base
$sql .= " WHERE ";
$sql .= " id=" . $id;
$sql .= " AND t.draft_flag=0" . LB;
//アクセス権のないデータ はのぞく
$sql .= COM_getPermSql('AND');
//公開日以前のデータはのぞく
$sql .= " AND (released <= NOW())";
//公開終了日を過ぎたデータはのぞく
$sql .= " AND (expired=0 OR expired > NOW())";
//
$result = DB_query($sql);
$numrows = DB_numRows($result);
if ($numrows > 0) {
$A = DB_fetchArray($result);
$A = array_map('stripslashes', $A);
if ($A['commentcode'] >= 0) {
$delete_option = SEC_hasRights('userbox.edit') && SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3 ? true : false;
require_once $_CONF['path_system'] . 'lib-comment.php';
$retval .= CMT_userComments($id, $A['topic'], 'userbox', $order, $mode, 0, $page, false, $delete_option, $A['commentcode']);
}
}
return $retval;
}
示例2: _mg_displaycomment
/**
* Plugin function to display a specific comment thread
* $id Unique idenifier for item comment belongs to
* $cid Comment id to display (possibly including sub-comments)
* $title Page/comment title
* $order 'ASC' or 'DSC' or blank
* $format 'threaded', 'nested', or 'flat'
* $page Page number of comments to display
* $view True to view comment (by cid), false to display (by $pid)
*/
function _mg_displaycomment($id, $commentid, $title, $order, $format, $page, $view)
{
global $_CONF, $_USER, $_MG_CONF, $LANG_LOGIN;
if (COM_isAnonUser() && $_MG_CONF['loginrequired']) {
echo SEC_loginRequiredForm();
exit;
}
$retval = '';
require_once $_CONF['path'] . 'plugins/mediagallery/include/classAlbum.php';
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-media.php';
list($ptitle, $retval, $themeCSS, $album_id) = MG_displayMediaImage($id, 0, 0, 0);
$retval = $themeCSS . $retval;
if (SEC_hasRights('mediagallery.admin')) {
$delete_option = true;
} else {
$delete_option = false;
}
$view = $view == 1 ? true : false;
$retval .= CMT_userComments($id, $title, 'mediagallery', $order, $format, $commentid, $page, $view, $delete_option);
return $retval;
}
示例3: plugin_displaycomment_article
/**
* article: display [a] comment[s]
*
* @param string $id Unique idenifier for item comment belongs to
* @param int $cid Comment id to display (possibly including sub-comments)
* @param string $title Page/comment title
* @param string $order 'ASC' or 'DESC' or blank
* @param string $format 'threaded', 'nested', or 'flat'
* @param int $page Page number of comments to display
* @param boolean $view True to view comment (by cid), false to display (by $pid)
* @return mixed results of calling the plugin_displaycomment_ function
*/
function plugin_displaycomment_article($id, $cid, $title, $order, $format, $page, $view)
{
global $_TABLES, $LANG_ACCESS;
$retval = '';
$sql = 'SELECT COUNT(*) AS count, commentcode, owner_id, group_id, perm_owner, perm_group, ' . "perm_members, perm_anon FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta WHERE (sid = '{$id}') " . 'AND (draft_flag = 0) AND (commentcode >= 0) AND (date <= NOW()) AND ta.type = "article" AND ta.id = sid ' . COM_getPermSQL('AND') . COM_getTopicSQL('AND', 0, 'ta') . ' GROUP BY sid, owner_id, group_id, perm_owner, perm_group,perm_members, perm_anon ';
$result = DB_query($sql);
$A = DB_fetchArray($result);
$allowed = $A['count'];
if ($allowed > 0) {
// Was equal 1 but when multiple topics in play the comment could belong to more than onetopic creating a higher count
$delete_option = SEC_hasRights('story.edit') && SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3;
$retval .= CMT_userComments($id, $title, 'article', $order, $format, $cid, $page, $view, $delete_option, $A['commentcode']);
} else {
$retval .= COM_showMessageText($LANG_ACCESS['storydenialmsg'], $LANG_ACCESS['accessdenied']);
}
return $retval;
}
示例4: adDetail
//.........这里部分代码省略.........
if ($srchval != '') {
$ad['subject'] = COM_highlightQuery($ad['subject'], $srchval);
$ad['descript'] = COM_highlightQuery($ad['descript'], $srchval);
}
$detail = new Template(CLASSIFIEDS_PI_PATH . '/templates');
$detail->set_file('detail', 'detail.thtml');
if ($admin) {
$base_url = CLASSIFIEDS_ADMIN_URL . '/index.php';
$del_link = $base_url . '?delete=ad&ad_id=' . $ad_id;
$edit_link = $base_url . '?edit=ad&ad_id=' . $ad_id;
} else {
$base_url = CLASSIFIEDS_URL . '/index.php';
$del_link = $base_url . '?mode=Delete&id=' . $ad_id;
$edit_link = $base_url . '?mode=editad&id=' . $ad_id;
}
// Set up the "add days" form if this user is the owner
// or an admin
if ($my_access == 3) {
// How many days has the ad run?
$max_add_days = CLASSIFIEDS_calcMaxAddDays(($ad['exp_date'] - $ad['add_date']) / 86400);
if ($max_add_days > 0) {
$detail->set_var('max_add_days', $max_add_days);
}
}
if ($ad['exp_date'] < $time) {
$detail->set_var('is_expired', 'true');
}
USES_classifieds_class_category();
$detail->set_var(array('base_url' => $base_url, 'edit_link' => $edit_link, 'del_link' => $del_link, 'curr_loc' => adCategory::BreadCrumbs($cat, true), 'subject' => $ad['subject'], 'add_date' => date($_CONF['shortdate'], $ad['add_date']), 'exp_date' => date($_CONF['shortdate'], $ad['exp_date']), 'views_no' => $ad['views'], 'descript' => $ad['descript'], 'ad_type' => CLASSIFIEDS_getAdTypeString($ad['ad_type']), 'uinfo_address' => $uinfo['address'], 'uinfo_city' => $uinfo['city'], 'uinfo_state' => $uinfo['state'], 'uinfo_postcode' => $uinfo['postcode'], 'uinfo_tel' => $uinfo['tel'], 'uinfo_fax' => $uinfo['fax'], 'price' => $ad['price'], 'ad_id' => $ad_id, 'ad_url' => $ad['url'], 'username' => $_CONF_ADVT['disp_fullname'] == 1 ? COM_getDisplayName($ad['uid']) : DB_getItem($_TABLES['users'], 'username', "uid={$ad['uid']}"), 'fgcolor' => $ad['fgcolor'], 'bgcolor' => $ad['bgcolor'], 'cat_id' => $ad['cat_id']));
// Display a link to email the poster, or other message as needed
$emailfromuser = DB_getItem($_TABLES['userprefs'], 'emailfromuser', "uid={$ad['uid']}");
if ($_CONF['emailuserloginrequired'] == 1 && COM_isAnonUser() || $emailfromuser < 1) {
$detail->set_var('ad_uid', '');
} else {
$detail->set_var('ad_uid', $ad['uid']);
}
if ($my_access == 3) {
$detail->set_var('have_userlinks', 'true');
if ($admin || $_CONF_ADVT['usercanedit'] == 1) {
$detail->set_var('have_editlink', 'true');
} else {
$detail->set_var('have_editlink', '');
}
} else {
$detail->set_var('have_userlinks', '');
}
// Retrieve the photos and put into the template
$sql = "SELECT photo_id, filename\n FROM {$_TABLES['ad_photo']} \n WHERE ad_id='{$ad_id}'";
$photo = DB_query($sql);
$photo_detail = '';
$detail->set_var('have_photo', '');
// assume no photo available
if ($photo && DB_numRows($photo) >= 1) {
while ($prow = DB_fetchArray($photo)) {
$img_small = LGLIB_ImageUrl(CLASSIFIEDS_IMGPATH . '/' . $prow['filename'], $_CONF_ADVT['detail_img_width']);
$img_disp = CLASSIFIEDS_dispUrl($prow['filename']);
if (!empty($img_small)) {
$detail->set_block('detail', 'PhotoBlock', 'PBlock');
$detail->set_var(array('tn_width' => $_CONF_ADVT['detail_img_width'], 'small_url' => $img_small, 'disp_url' => $img_disp));
$detail->parse('PBlock', 'PhotoBlock', true);
$detail->set_var('have_photo', 'true');
}
}
}
if (DB_count($_TABLES['ad_ads'], 'owner_id', (int) $ad['owner_id']) > 1) {
$detail->set_var('byposter_url', CLASSIFIEDS_URL . '/index.php?' . "page=byposter&uid={$ad['owner_id']}");
}
// Show previous and next ads
if ($preAd_id != '') {
$detail->set_var('previous', '<a href="' . CLASSIFIEDS_makeURL('detail', $preAd_id) . "\"><<</a>");
}
if ($nextAd_id != '') {
$detail->set_var('next', '<a href="' . CLASSIFIEDS_makeURL('detail', $nextAd_id) . "\"> >></a>");
}
// Show the "hot results"
$hot_data = '';
if ($hotresult) {
$detail->set_block('detail', 'HotBlock', 'HBlock');
while ($hotrow = DB_fetchArray($hotresult)) {
$detail->set_var(array('hot_title' => $hotrow['subject'], 'hot_url' => CLASSIFIEDS_makeURL('detail', $hotrow['ad_id']), 'hot_cat' => displayCat($hotrow['cat_id'])));
/*$hot_data .= "<tr><td class=\"hottitle\"><a href=\"" .
CLASSIFIEDS_makeURL('detail', $hotrow['ad_id']) .
"\">{$hotrow['subject']}</a></small></td>\n";
$hot_data .= "<td class=\"hotcat\">( " . displayCat($hotrow['cat_id']) .
" )</td></tr>\n";*/
}
$detail->parse('HBlock', 'HotBlock', true);
}
$detail->set_var('whats_hot_row', $hot_data);
// Show the user comments
if (plugin_commentsupport_classifieds() && $ad['comments_enabled'] < 2) {
$detail->set_var('usercomments', CMT_userComments($ad_id, $ad['subject'], 'classifieds', '', '', 0, 1, false, false, $ad['comments_enabled']));
//$detail->set_var('usercomments', CMT_userComments($ad_id, $subject,
// 'classifieds'));
}
$detail->parse('output', 'detail');
$display = $detail->finish($detail->get_var('output'));
return $display;
}
示例5: COM_userComments
/**
* DEPRECIATED -- see CMT_userComments in lib-comment.php
* @deprecated since Geeklog 1.4.0
* @see CMT_userComments
*/
function COM_userComments($sid, $title, $type = 'article', $order = '', $mode = '', $pid = 0, $page = 1, $cid = false, $delete_option = false)
{
global $_CONF;
require_once $_CONF['path_system'] . 'lib-comment.php';
return CMT_userComments($sid, $title, $type, $order, $mode, $pid, $page, $cid, $delete_option);
}
示例6: DB_query
$result2 = DB_query("SELECT username,fullname,photo FROM {$_TABLES['users']} WHERE uid = {$submitter}");
list($submitter_name, $submitter_fullname, $photo) = DB_fetchArray($result2);
$submitter_name = COM_getDisplayName($submitter, $submitter_name, $submitter_fullname);
include $_CONF['path_html'] . '/filemgmt/include/dlformat.php';
$p->set_var('cssid', 1);
$p->parse('filelisting_records', 'records');
$delete_option = SEC_hasRights('filemgmt.edit');
$order = '';
if (isset($_POST['order'])) {
$order = COM_applyFilter($_POST['order']);
}
$mode = '';
if (isset($_POST['mode'])) {
$mode = COM_applyFilter($_POST['mode']);
}
$p->set_var('comment_records', CMT_userComments("fileid_{$lid}", $dtitle, 'filemgmt', $order, $mode, 0, 1, false, $delete_option));
$p->set_var('subcategories', '');
$p->set_var('new_table_row', '<tr>');
$p->set_var('end_of_row', '</tr>');
$p->parse('category_records', 'category');
$p->parse('output', 'page');
$display .= $p->finish($p->get_var('output'));
} else {
$p = new Template($_CONF['path'] . 'plugins/filemgmt/templates');
$p->set_file(array('page' => 'filelisting.thtml', 'records' => 'filelisting_record.thtml', 'category' => 'filelisting_category.thtml'));
$p->set_var('layout_url', $_CONF['layout_url']);
$p->set_var('site_url', $_CONF['site_url']);
$p->set_var('site_admin_url', $_CONF['site_admin_url']);
$p->set_var('xhtml', XHTML);
$p->set_var('target', $CONF_FM['ignore_target'] ? '' : 'target="_blank"');
$p->set_var('imgset', $_CONF['layout_url'] . '/nexflow/images');
示例7: handleView
/**
* Handles a comment view request
*
* @copyright Vincent Furia 2005
* @author Vincent Furia, vinny01 AT users DOT sourceforge DOT net
* @param boolean $view View or display (true for view)
* @return string HTML (possibly a refresh)
*/
function handleView($view = true)
{
global $_CONF, $_TABLES, $_USER, $LANG_ACCESS;
$display = '';
if ($view) {
$cid = COM_applyFilter($_REQUEST['cid'], true);
} else {
$cid = COM_applyFilter($_REQUEST['pid'], true);
}
if ($cid <= 0) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$sql = "SELECT sid, title, type FROM {$_TABLES['comments']} WHERE cid = {$cid}";
$A = DB_fetchArray(DB_query($sql));
$sid = $A['sid'];
$title = $A['title'];
$type = $A['type'];
$format = $_CONF['comment_mode'];
if (isset($_REQUEST['format'])) {
$format = COM_applyFilter($_REQUEST['format']);
}
if ($format != 'threaded' && $format != 'nested' && $format != 'flat') {
if (COM_isAnonUser()) {
$format = $_CONF['comment_mode'];
} else {
$format = DB_getItem($_TABLES['usercomment'], 'commentmode', "uid = {$_USER['uid']}");
}
}
switch ($type) {
case 'article':
$sql = 'SELECT COUNT(*) AS count, commentcode, owner_id, group_id, perm_owner, perm_group, ' . "perm_members, perm_anon FROM {$_TABLES['stories']} WHERE (sid = '{$sid}') " . 'AND (draft_flag = 0) AND (commentcode >= 0) AND (date <= NOW())' . COM_getPermSQL('AND') . COM_getTopicSQL('AND') . ' GROUP BY sid,owner_id, group_id, perm_owner, perm_group,perm_members, perm_anon ';
$result = DB_query($sql);
$B = DB_fetchArray($result);
$allowed = $B['count'];
if ($allowed == 1) {
$delete_option = SEC_hasRights('story.edit') && SEC_hasAccess($B['owner_id'], $B['group_id'], $B['perm_owner'], $B['perm_group'], $B['perm_members'], $B['perm_anon']) == 3;
$order = '';
if (isset($_REQUEST['order'])) {
$order = COM_applyFilter($_REQUEST['order']);
}
$page = 0;
if (isset($_REQUEST['page'])) {
$page = COM_applyFilter($_REQUEST['page'], true);
}
$display .= CMT_userComments($sid, $title, $type, $order, $format, $cid, $page, $view, $delete_option, $B['commentcode']);
} else {
$display .= COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . $LANG_ACCESS['storydenialmsg'] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
}
break;
default:
// assume plugin
$order = '';
if (isset($_REQUEST['order'])) {
$order = COM_applyFilter($_REQUEST['order']);
}
$page = 0;
if (isset($_REQUEST['page'])) {
$page = COM_applyFilter($_REQUEST['page'], true);
}
if (!($display = PLG_displayComment($type, $sid, $cid, $title, $order, $format, $page, $view))) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
break;
}
return COM_siteHeader('menu', $title) . COM_showMessageFromParameter() . $display . COM_siteFooter();
}
示例8: Detail
//.........这里部分代码省略.........
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);
}
$buttons = $this->PurchaseLinks();
$T->set_block('product', 'BtnBlock', 'Btn');
foreach ($buttons as $name => $html) {
if ($name == 'add_cart') {
// Set the add to cart button in the main form
$T->set_var('add_cart_button', $html);
} else {
$T->set_var('buy_now_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) {
$PP_ratedIds = RATING_getRatedIds('paypal');
if (in_array($prod_id, $PP_ratedIds)) {
$static = true;
$voted = 1;
} elseif (plugin_canuserrate_paypal($A['id'], $_USER['uid'])) {
$static = 0;
$voted = 0;
} else {
$static = 1;
$voted = 0;
}
$rating_box = RATING_ratingBar('paypal', $prod_id, $this->votes, $this->rating, $voted, 5, $static, 'sm');
$T->set_var('rating_bar', $rating_box);
} else {
$T->set_var('ratign_bar', '');
}
if ($this->isAdmin) {
// Add the quick-edit link for administrators
$T->set_var(array('pi_admin_url' => PAYPAL_ADMIN_URL, 'can_edit' => 'true'));
}
$retval .= $T->parse('output', 'product');
// Update the hit counter
DB_query("UPDATE {$_TABLES['paypal.products']}\n SET views = views + 1\n WHERE id = '{$prod_id}'");
$retval .= COM_endBlock();
return $retval;
}
示例9: Detail
/**
* 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) {
//.........这里部分代码省略.........
示例10: explode
}
$article_arr = explode('[page_break]', $story->displayElements('bodytext'));
$conf = $_CONF['page_break_comments'];
if ($conf == 'all' or $conf == 'first' and $story_page == 1 or $conf == 'last' and count($article_arr) == $story_page) {
$show_comments = true;
} else {
$show_comments = false;
}
} else {
$show_comments = true;
}
// Display the comments, if there are any ..
if ($story->displayElements('commentcode') >= 0 and $show_comments) {
$delete_option = SEC_hasRights('story.edit') && $story->getAccess() == 3 ? true : false;
require_once $_CONF['path_system'] . 'lib-comment.php';
$story_template->set_var('commentbar', CMT_userComments($story->getSid(), $story->displayElements('title'), 'article', $order, $mode, 0, $page, false, $delete_option, $story->displayElements('commentcode')));
}
if ($_CONF['trackback_enabled'] && $story->displayElements('trackbackcode') >= 0 && $show_comments) {
if (SEC_hasRights('story.ping')) {
if ($story->displayElements('draft_flag') == 0 && $story->displayElements('day') < time()) {
$url = $_CONF['site_admin_url'] . '/trackback.php?mode=sendall&id=' . $story->getSid();
$story_template->set_var('send_trackback_link', COM_createLink($LANG_TRB['send_trackback'], $url));
$story_template->set_var('send_trackback_url', $url);
$story_template->set_var('lang_send_trackback_text', $LANG_TRB['send_trackback']);
}
}
$permalink = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid());
$story_template->set_var('trackback', TRB_renderTrackbackComments($story->getSID(), 'article', $story->displayElements('title'), $permalink));
} else {
$story_template->set_var('trackback', '');
}
示例11: CMT_handleComment
//.........这里部分代码省略.........
if (!empty($_REQUEST['cpage'])) {
$cpage = COM_applyFilter($_REQUEST['cpage'], true);
if (empty($cpage)) {
$cpage = 1;
}
}
$is_comment_page = CMT_isCommentPage();
$retval = '';
if ($_CONF['show_comments_at_replying'] && $is_comment_page && !empty($sid) && !empty($type) && in_array($commentmode, array('', $LANG03[28], $LANG03[34], $LANG03[14], 'edit'))) {
if ($commentmode == 'edit') {
$cid = 0;
if (isset($_REQUEST[CMT_CID])) {
$cid = COM_applyFilter($_REQUEST[CMT_CID], true);
}
if ($cid <= 0) {
COM_errorLog("CMT_handleComment(): {$_USER['uid']} from {$_SERVER['REMOTE_ADDR']} tried " . 'to edit a comment with one or more missing/bad values.');
return COM_refresh($_CONF['site_url'] . '/index.php');
}
$pid = $cid;
}
if ($pid > 0 && empty($title)) {
$atype = DB_escapeString($type);
$title = DB_getItem($_TABLES['comments'], 'title', "(cid = {$pid}) AND (type = '{$atype}')");
}
if (empty($title)) {
$title = PLG_getItemInfo($type, $sid, 'title');
$title = str_replace('$', '$', $title);
// CMT_userComments expects non-htmlspecial chars for title...
$title = str_replace('&', '&', $title);
$title = str_replace('"', '"', $title);
$title = str_replace('<', '<', $title);
$title = str_replace('>', '>', $title);
}
$retval .= CMT_userComments($sid, $title, $type, $order, $format, $pid, $cpage, $pid > 0, false, 0);
}
switch ($commentmode) {
case $LANG03[28]:
// Preview Changes (for edit)
// Preview Changes (for edit)
case $LANG03[34]:
// Preview Submission changes (for edit)
// Preview Submission changes (for edit)
case $LANG03[14]:
// Preview
$retval .= CMT_commentForm($title, $_POST['comment'], $sid, $pid, $type, $commentmode, $postmode, $format, $order, $cpage);
if ($is_comment_page) {
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG03[14]));
}
break;
case $LANG03[35]:
// Submit Changes to Moderation table
// Submit Changes to Moderation table
case $LANG03[29]:
// Submit Changes
if (SEC_checkToken()) {
$retval .= CMT_handleEditSubmit($commentmode);
} else {
echo COM_refresh($_CONF['site_url'] . '/index.php');
exit;
}
break;
case $LANG03[11]:
// Submit comment
$retval .= CMT_handleSubmit($title, $sid, $pid, $type, $postmode, $uid);
break;
case $LANG_ADMIN['delete']:
示例12: COM_applyFilter
$cmt_order = $_GET['order'] == 'ASC' ? 'ASC' : 'DESC';
} else {
$cmt_order = '';
}
if (isset($_POST['mode'])) {
$cmt_mode = COM_applyFilter($_POST['mode']);
} elseif (isset($_GET['mode'])) {
$cmt_mode = COM_applyFilter($_GET['mode']);
} else {
$cmt_mode = '';
}
$valid_cmt_modes = array('flat', 'nested', 'nocomment', 'threaded', 'nobar');
if (!in_array($cmt_mode, $valid_cmt_modes)) {
$cmt_mode = '';
}
$p->set_var('comment_records', CMT_userComments("fileid_{$lid}", $title, 'filemgmt', $cmt_order, $cmt_mode, 0, $cmt_page, false, $delete_option, 0, $submitter));
} else {
$p->set_var('comment_records', '');
}
$p->parse('output', 'page');
$display .= $p->finish($p->get_var('output'));
} else {
$display = FM_siteHeader($LANG_FILEMGMT['usermenu1']);
$p = new Template($_CONF['path'] . 'plugins/filemgmt/templates');
$p->set_file(array('page' => 'filelisting.thtml', 'records' => 'filelisting_record.thtml', 'category' => 'filelisting_category.thtml'));
$p->set_var('imgset', $_CONF['layout_url'] . '/nexflow/images');
$p->set_var('tablewidth', $mydownloads_shotwidth + 10);
$page = isset($_GET['page']) ? COM_applyFilter($_GET['page'], true) : 0;
if (!isset($page) or $page == 0) {
$page = 1;
}
示例13: plugin_displaycomment_article
/**
* article: display comment(s)
*
* @param string $id Unique idenifier for item comment belongs to
* @param int $cid Comment id to display (possibly including sub-comments)
* @param string $title Page/comment title
* @param string $order 'ASC' or 'DESC' or blank
* @param string $format 'threaded', 'nested', or 'flat'
* @param int $page Page number of comments to display
* @param boolean $view True to view comment (by cid), false to display (by $pid)
* @return mixed results of calling the plugin_displaycomment_ function
*/
function plugin_displaycomment_article($id, $cid, $title, $order, $format, $page, $view)
{
global $_CONF, $_TABLES, $LANG_ACCESS;
USES_lib_story();
USES_class_story();
$retval = '';
// display story
$sql = "SELECT s.*, UNIX_TIMESTAMP(s.date) AS unixdate, " . 'UNIX_TIMESTAMP(s.expire) as expireunix, ' . "u.uid, u.username, u.fullname, t.topic, t.imageurl " . "FROM {$_TABLES['stories']} AS s LEFT JOIN {$_TABLES['users']} AS u ON s.uid=u.uid " . "LEFT JOIN {$_TABLES['topics']} AS t on s.tid=t.tid " . "WHERE (sid = '" . DB_escapeString($id) . "') " . 'AND (draft_flag = 0) AND (commentcode >= 0) AND (date <= NOW())' . COM_getPermSQL('AND', 0, 2, 's') . COM_getTopicSQL('AND', 0, 't') . ' GROUP BY sid,owner_id, group_id, perm_owner, s.perm_group,s.perm_members, s.perm_anon ';
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($A = DB_fetchArray($result)) {
$story = new Story();
$story->loadFromArray($A);
$retval .= STORY_renderArticle($story, 'n');
}
// end
$sql = 'SELECT COUNT(*) AS count, commentcode, uid, owner_id, group_id, perm_owner, perm_group, ' . "perm_members, perm_anon FROM {$_TABLES['stories']} " . "WHERE (sid = '" . DB_escapeString($id) . "') " . 'AND (draft_flag = 0) AND (commentcode >= 0) AND (date <= NOW())' . COM_getPermSQL('AND') . COM_getTopicSQL('AND') . ' GROUP BY sid,owner_id, group_id, perm_owner, perm_group,perm_members, perm_anon ';
$result = DB_query($sql);
$B = DB_fetchArray($result);
$allowed = $B['count'];
if ($allowed == 1) {
$delete_option = SEC_hasRights('story.edit') && SEC_hasAccess($B['owner_id'], $B['group_id'], $B['perm_owner'], $B['perm_group'], $B['perm_members'], $B['perm_anon']) == 3;
$retval .= CMT_userComments($id, $title, 'article', $order, $format, $cid, $page, $view, $delete_option, $B['commentcode'], $B['uid']);
} else {
$retval .= COM_showMessageText($LANG_ACCESS['storydenialmsg'], $LANG_ACCESS['accessdenied'], true);
}
return $retval;
}
示例14: MG_displayMedia
//.........这里部分代码省略.........
if ($mg_album->enable_keywords == 1 && !empty($media['media_keywords'])) {
$lang_keywords = $LANG_MG01['keywords'];
$keyWords = array();
$keyWords = explode(' ', $media['media_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>';
}
}
$media_user_id = $media['media_user_id'];
if (empty($media_user_id)) {
$media_user_id = 0;
}
$displayname = $_CONF['show_fullname'] ? 'fullname' : 'username';
$owner_name = DB_getItem($_TABLES['users'], $displayname, "uid = {$media_user_id}");
if (empty($owner_name)) {
$owner_name = DB_getItem($_TABLES['users'], 'username', "uid = {$media_user_id}");
if (empty($owner_name)) {
$owner_name = 'unknown';
}
}
$owner_link = $owner_name;
if ($owner_name != 'unknown') {
$owner_link = '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $media_user_id . '">' . $owner_name . '</a>';
}
$property = '';
if (($mg_album->exif_display == 2 || $mg_album->exif_display == 3) && $media['media_type'] == 0) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
$haveEXIF = MG_haveEXIF($media['media_id']);
if ($haveEXIF) {
$property = $_MG_CONF['site_url'] . '/property.php?mid=' . $media['media_id'];
}
}
$media_id = '';
if ($root_album->owner_id || $_MG_CONF['enable_media_id'] == 1) {
$media_id = $media['media_id'];
}
$exif_info = '';
if (($mg_album->exif_display == 1 || $mg_album->exif_display == 3) && $media['media_type'] == 0) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
$haveEXIF = MG_haveEXIF($media['media_id']);
if ($haveEXIF) {
$exif_info = MG_readEXIF($media['media_id'], 2);
}
}
$T = COM_newTemplate(MG_getTemplatePath_byName($mg_album->skin));
switch ($media['media_type']) {
case '0':
// image
$T->set_file('page', 'view_image.thtml');
break;
case '1':
// video
// video
case '5':
// embedded video
$T->set_file('page', 'view_video.thtml');
break;
case '2':
// audio
$T->set_file('page', 'view_audio.thtml');
break;
default:
$T->set_file('page', 'view_image.thtml');
break;
}
$T->set_var(array('header' => $LANG_MG00['plugin'], 'site_url' => $_MG_CONF['site_url'], 'plugin' => 'mediagallery', 'birdseed' => $birdseed, 'lang_slideshow_link' => $LANG_MG03['slide_show'], 'image_detail' => $u_image, 'media_title' => isset($media['media_title']) && $media['media_title'] != ' ' ? PLG_replaceTags($media['media_title']) : '', 'album_title' => $mg_album->title, 'media_desc' => isset($media['media_desc']) && $media['media_desc'] != ' ' ? $media_desc : '', 'media_time' => $media_date[0], 'media_views' => $mg_album->enable_views ? $media['media_views'] : '', 'media_comments' => $mg_album->enable_comments ? $media['media_comments'] : '', 'pagination' => $pagination, 'media_number' => sprintf("%s %d %s %d", $LANG_MG03['image'], $key + 1, $LANG_MG03['of'], $total_media), 'jumpbox' => $album_jumpbox, 'rating_box' => $rating_box, 'download' => $download, 'download_link' => $download_link, 'lang_download' => $LANG_MG01['download'], 'edit_item' => $edit_item, 'edit_item_link' => $edit_item_link, 'lang_edit' => $LANG_MG01['edit'], 'lang_prev' => $LANG_MG03['previous'], 'lang_next' => $LANG_MG03['next'], 'next_link' => $nextLink, 'prev_link' => $prevLink, 'image_height' => $raw_image_height, 'image_width' => $raw_image_width, 'left_side' => intval($raw_image_width / 2) - 1, 'right_side' => intval($raw_image_width / 2), 'raw_image' => $raw_image, 'raw_link_url' => $raw_link_url, 'item_number' => $key + 1, 'total_items' => $total_media, 'lang_of' => $LANG_MG03['of'], 'album_link' => $album_link, 'switch_size' => $switch_size, 'lang_switch_size' => $lang_switch_size, 'switch_size_link' => $switch_viewsize_link, 'getid3' => $getid3link, 'getid3end' => $getid3linkend, 'media_properties' => $media_properties, 'media_keywords' => $kwText, 'lang_keywords' => $lang_keywords, 'owner_username' => $owner_link, 'property' => $property, 'lang_property' => $LANG_MG04['exif_header'], 'media_id' => $media_id, 'exif_info' => $exif_info, 'lang_comments' => $mg_album->enable_comments ? $LANG_MG03['comments'] : '', 'lang_views' => $mg_album->enable_views ? $LANG_MG03['views'] : '', 'lang_title' => $LANG_MG01['title'], 'lang_uploaded_by' => $LANG_MG01['uploaded_by'], 'album_id' => $aid, 'lang_search' => $LANG_MG01['search']));
MG_buildSlideshow($mg_album, $T, $sortOrder);
PLG_templateSetVars('mediagallery', $T);
$retval .= $T->finish($T->parse('output', 'page'));
if ($comments) {
// Geeklog Comment support
$sid = $media['media_id'];
require_once $_CONF['path_system'] . 'lib-comment.php';
$delete_option = false;
if ($mg_album->access == 3 || $root_album->owner_id) {
$delete_option = true;
}
$page = isset($_GET['page']) ? COM_applyFilter($_GET['page'], true) : 0;
$comorder = '';
if (isset($_POST['order'])) {
$comorder = COM_applyFilter($_POST['order']);
} elseif (isset($_GET['order'])) {
$comorder = COM_applyFilter($_GET['order']);
}
$commode = '';
if (isset($_POST['mode'])) {
$commode = COM_applyFilter($_POST['mode']);
} elseif (isset($_GET['mode'])) {
$commode = COM_applyFilter($_GET['mode']);
}
$commentcode = 0;
// 今のところ無条件にコメント投稿を許可。
$retval .= CMT_userComments($sid, $media['media_title'], 'mediagallery', $comorder, $commode, 0, $page, false, $delete_option, $commentcode);
}
return array(strip_tags($media['media_title']), $retval, $aid);
}
示例15: MG_displayMediaImage
//.........这里部分代码省略.........
$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']));
} else {
$T->set_var(array('media_keywords' => '', 'lang_keywords' => ''));
}
if ($media[$mediaObject]['media_user_id'] == '' || !isset($media[$mediaObject]['media_user_id'])) {
$media[$mediaObject]['media_user_id'] = 0;
}
if ($_CONF['show_fullname']) {
$displayname = 'fullname';
} else {
$displayname = 'username';
}
$owner_name = DB_getItem($_TABLES['users'], $displayname, "uid = {$media[$mediaObject]['media_user_id']}");
if (empty($owner_name) || $owner_name == '') {
$owner_name = DB_getItem($_TABLES['users'], 'username', "uid = {$media[$mediaObject]['media_user_id']}");
if (empty($owner_name) || $owner_name == '') {
$owner_name = 'unknown';
}
}
if ($owner_name != 'unknown') {
$owner_link = '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $media[$mediaObject]['media_user_id'] . '">' . $owner_name . '</a>';
} else {
$owner_link = $owner_name;
}
$T->set_var('owner_username', $owner_link);
if (($MG_albums[$aid]->exif_display == 2 || $MG_albums[$aid]->exif_display == 3) && $media[$mediaObject]['media_type'] == 0) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
$haveEXIF = MG_haveEXIF($media[$mediaObject]['media_id']);
if ($haveEXIF) {
$T->set_var(array('property' => $_MG_CONF['site_url'] . '/property.php?mid=' . $media[$mediaObject]['media_id'], 'lang_property' => $LANG_MG04['exif_header']));
}
}
if ($MG_albums[0]->owner_id || $_MG_CONF['enable_media_id'] == 1) {
$T->set_var(array('media_id' => $media[$mediaObject]['media_id']));
}
// Language specific vars
$T->set_var(array('lang_comments' => $MG_albums[$aid]->enable_comments ? $LANG_MG03['comments'] : '', 'lang_views' => $MG_albums[$aid]->enable_views ? $LANG_MG03['views'] : '', 'lang_title' => $LANG_MG01['title'], 'print_shutterfly' => $LANG_MG03['print_shutterfly'], 'lang_uploaded_by' => $LANG_MG01['uploaded_by'], 'album_id' => $aid, 'lang_search' => $LANG_MG01['search']));
if (($MG_albums[$aid]->exif_display == 1 || $MG_albums[$aid]->exif_display == 3) && $media[$mediaObject]['media_type'] == 0) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
$haveEXIF = MG_haveEXIF($media[$mediaObject]['media_id']);
if ($haveEXIF) {
$exifData = MG_readEXIF($media[$mediaObject]['media_id'], 2);
$T->set_var(array('exif_info' => $exifData));
}
}
if ($sortID == 0) {
if ($MG_albums[$aid]->enable_postcard == 1 && !COM_isAnonUser() || $MG_albums[$aid]->enable_postcard == 2) {
if ($media[$mediaObject]['media_type'] == 0) {
$postcard_link = '<a href="' . $_MG_CONF['site_url'] . '/postcard.php?mode=edit&mid=' . $media[$mediaObject]['media_id'] . '"><img src="' . MG_getImageFile('icon_envelopeSmall.gif') . '" alt="' . $LANG_MG03['send_postcard'] . '" style="border:none;"/></a>';
$T->set_var('postcard_link', $postcard_link);
}
}
}
PLG_templateSetVars('mediagallery', $T);
$T->parse('output', 'page');
$retval .= $T->finish($T->get_var('output'));
if ($comments) {
// glFusion Comment support
$mid = $media[$mediaObject]['media_id'];
if ($MG_albums[$aid]->enable_comments == 1) {
USES_lib_comment();
if ($MG_albums[$aid]->access == 3 || $MG_albums[0]->owner_id) {
$delete_option = true;
} else {
$delete_option = false;
}
if (DB_count($_TABLES['comments'], 'sid', $mid) > 0 || $_MG_CONF['commentbar']) {
$cid = $mid;
$page = isset($_GET['page']) ? COM_applyFilter($_GET['page'], true) : 0;
if (isset($_POST['order'])) {
$comorder = $_POST['order'] == 'ASC' ? 'ASC' : 'DESC';
} elseif (isset($_GET['order'])) {
$comorder = $_GET['order'] == 'ASC' ? 'ASC' : 'DESC';
} else {
$comorder = '';
}
if (isset($_POST['mode'])) {
$commode = COM_applyFilter($_POST['mode']);
} elseif (isset($_GET['mode'])) {
$commode = COM_applyFilter($_GET['mode']);
} else {
$commode = '';
}
$valid_cmt_modes = array('flat', 'nested', 'nocomment', 'nobar');
if (!in_array($commode, $valid_cmt_modes)) {
$commode = 'nested';
}
$commentbar = CMT_userComments($cid, $media[$mediaObject]['media_title'], 'mediagallery', $comorder, $commode, 0, $page, false, $delete_option, 0, $media[$mediaObject]['media_user_id']);
$retval .= $commentbar;
} else {
$retval .= ' <center><a href="' . $_CONF['site_url'] . '/comment.php?sid=' . $mid . '&title=' . $title . '&pid=0&type=mediagallery' . '">' . $LANG01[60] . '</a></center>';
}
}
}
return array(strip_tags($media[$mediaObject]['media_title']), $retval, '', $aid);
}