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; }
/** * 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; }
/** * 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; }
/** * Display an ad's detail * @param string $ad_id ID of ad to display */ function adDetail($ad_id = '') { global $_USER, $_TABLES, $_CONF, $LANG_ADVT, $_CONF_ADVT; USES_lib_comments(); // Determind if this is an administrator $admin = SEC_hasRights($_CONF_ADVT['pi_name'] . '.admin'); $ad_id = COM_sanitizeID($ad_id); if ($ad_id == '') { // An ad id is required for this function return CLASSIFIEDS_errorMsg($LANG_ADVT['missing_id'], 'alert'); } $srchval = isset($_GET['query']) ? trim($_GET['query']) : ''; // We use this in a few places here, so might as well just // figure it out once and save it. $perm_sql = COM_getPermSQL('AND', 0, 2, 'ad') . ' ' . COM_getPermSQL('AND', 0, 2, 'cat'); // get the ad information. $sql = "SELECT ad.*\n FROM {$_TABLES['ad_ads']} ad\n LEFT JOIN {$_TABLES['ad_category']} cat\n ON ad.cat_id = cat.cat_id\n WHERE ad_id='{$ad_id}'"; if (!$admin) { $sql .= $perm_sql; } $result = DB_query($sql); if (!$result || DB_numRows($result) < 1) { return CLASSIFIEDS_errorMsg($LANG_ADVT['no_ad_found'], 'note', 'Oops...'); } $ad = DB_fetchArray($result, false); // Check access to the ad. If granted, check that access isn't // blocked by any category. $my_access = CLASSIFIEDS_checkAccess($ad['ad_id'], $ad); if ($my_access >= 2) { $my_cat_access = CLASSIFIEDS_checkCatAccess($ad['cat_id'], false); if ($my_cat_access < $my_access) { $my_access = $my_cat_access; } } if ($my_access < 2) { return CLASSIFIEDS_errorMsg($LANG_ADVT['no_permission'], 'alert', $LANG_ADVT['access_denied']); } $cat = (int) $ad['cat_id']; // Increment the views counter $sql = "UPDATE {$_TABLES['ad_ads']} \n SET views = views + 1 \n WHERE ad_id='{$ad_id}'"; DB_query($sql); // Get the previous and next ads $condition = " AND ad.cat_id={$cat}"; if (!$admin) { $condition .= $perm_sql; } $sql = "SELECT ad_id\n FROM {$_TABLES['ad_ads']} ad\n LEFT JOIN {$_TABLES['ad_category']} cat\n ON ad.cat_id = cat.cat_id\n WHERE ad_id < '{$ad_id}' \n {$condition}\n ORDER BY ad_id DESC\n LIMIT 1"; $r = DB_query($sql); list($preAd_id) = DB_fetchArray($r, false); $sql = "SELECT ad_id\n FROM {$_TABLES['ad_ads']} ad\n LEFT JOIN {$_TABLES['ad_category']} cat\n ON ad.cat_id = cat.cat_id\n WHERE ad_id > '{$ad_id}' \n {$condition}\n ORDER BY ad_id ASC\n LIMIT 1"; $r = DB_query($sql); list($nextAd_id) = DB_fetchArray($r, false); // Get the user contact info. If none, just show the email link $sql = "SELECT * \n FROM {$_TABLES['ad_uinfo']} \n WHERE uid='{$ad['uid']}'"; //echo $sql; $result = DB_query($sql); $uinfo = array(); if ($result && DB_numRows($result) > 0) { $uinfo = DB_fetchArray($result); } else { $uinfo['uid'] = ''; $uinfo['address'] = ''; $uinfo['city'] = ''; $uinfo['state'] = ''; $uinfo['postal'] = ''; $uinfo['tel'] = ''; $uinfo['fax'] = ''; } // Get the hot results (most viewed ads) $time = time(); $sql = "SELECT ad.ad_id, ad.cat_id, ad.subject,\n cat.cat_id, cat.fgcolor, cat.bgcolor\n FROM {$_TABLES['ad_ads']} ad\n LEFT JOIN {$_TABLES['ad_category']} cat\n ON ad.cat_id = cat.cat_id\n WHERE ad.exp_date > {$time} \n {$perm_sql}\n ORDER BY views DESC \n LIMIT 4"; //echo $sql;die; $hotresult = DB_query($sql); // convert line breaks & others to html $patterns = array('/\\n/'); $replacements = array('<br />'); $ad['descript'] = PLG_replaceTags(COM_checkHTML($ad['descript'])); $ad['descript'] = preg_replace($patterns, $replacements, $ad['descript']); $ad['subject'] = strip_tags($ad['subject']); $ad['price'] = strip_tags($ad['price']); $ad['url'] = COM_sanitizeUrl($ad['url']); $ad['keywords'] = strip_tags($ad['keywords']); // Highlight search terms, if any 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; }
/** * 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); }
$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');
/** * 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(); }
/** * 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); } $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; }
/** * 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) { $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; }
} $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', ''); }
/** * Handles comment processing * * @param string $mode Mode of comment processing * @param string $type Type of item (article, polls, etc.) * @param string $title Title of item * @param string $sid ID for item to show comments for * @param string $format 'threaded', 'nested', or 'flat' * @return string HTML formated */ function CMT_handleComment($mode = '', $type = '', $title = '', $sid = '', $format = '') { global $_CONF, $_TABLES, $_USER, $LANG03, $LANG_ADMIN, $topic, $_PLUGINS; $commentmode = ''; if (!empty($_REQUEST[CMT_MODE])) { $commentmode = COM_applyFilter($_REQUEST[CMT_MODE]); } if (empty($mode)) { $mode = COM_applyFilter(COM_getArgument(CMT_MODE)); } if (empty($commentmode) && !empty($mode)) { $commentmode = $mode; } if (empty($sid) && !empty($_REQUEST[CMT_SID])) { $sid = COM_applyFilter($_REQUEST[CMT_SID]); } $pid = 0; if (!empty($_REQUEST[CMT_PID])) { $pid = COM_applyFilter($_REQUEST[CMT_PID], true); } if (empty($type) && !empty($_REQUEST[CMT_TYPE])) { $type = COM_applyFilter($_REQUEST[CMT_TYPE]); } if (!empty($_REQUEST['title'])) { $title = $_REQUEST['title']; // apply filters later in CMT_commentForm or CMT_saveComment } if (!empty($_REQUEST[CMT_UID])) { $uid = COM_applyFilter($_REQUEST[CMT_UID]); } else { $uid = 1; if (!empty($_USER['uid'])) { $uid = $_USER['uid']; } } $postmode = $_CONF['postmode']; if (isset($_REQUEST['postmode'])) { $postmode = COM_applyFilter($_REQUEST['postmode']); } $formtype = ''; if (!empty($_REQUEST['formtype'])) { $formtype = COM_applyFilter($_REQUEST['formtype']); } // Get comment id, may not be there...will handle in function $cid = 0; if (isset($_REQUEST[CMT_CID])) { $cid = COM_applyFilter($_REQUEST[CMT_CID], true); } TOPIC_getTopic('comment', $cid); if (empty($format) && isset($_REQUEST['format'])) { $format = COM_applyFilter($_REQUEST['format']); } if (!in_array($format, array('threaded', 'nested', 'flat', 'nocomment'))) { if (COM_isAnonUser()) { $format = $_CONF['comment_mode']; } else { $format = DB_getItem($_TABLES['usercomment'], 'commentmode', "uid = {$_USER['uid']}"); } } $order = ''; if (isset($_REQUEST['order'])) { $order = COM_applyFilter($_REQUEST['order']); } $cpage = 1; 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']: case 'delete': // Delete comment if (SEC_checkToken()) { $retval .= CMT_handleDelete($sid, $type, $formtype); } else { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } break; case 'view': // View comment by $cid $retval .= CMT_handleView($format, $order, $cpage, true); break; case 'display': // View comment by $pid $retval .= CMT_handleView($format, $order, $cpage, false); break; case 'report': if ($is_comment_page) { $cid = 0; if (isset($_GET[CMT_CID])) { $cid = COM_applyFilter($_GET[CMT_CID], true); } $type = ''; if (isset($_GET[CMT_TYPE])) { $type = COM_applyFilter($_GET[CMT_TYPE]); } if ($cid <= 0 || empty($type)) { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } $retval .= CMT_reportAbusiveComment($cid, $type); $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG03[27])); } break; case 'sendreport': if (SEC_checkToken()) { $cid = 0; if (isset($_POST[CMT_CID])) { $cid = COM_applyFilter($_POST[CMT_CID], true); } $type = ''; if (isset($_POST[CMT_TYPE])) { $type = COM_applyFilter($_POST[CMT_TYPE]); } if ($cid <= 0 || empty($type)) { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } $retval .= CMT_sendReport($cid, $type); } else { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } break; case 'editsubmission': if (!SEC_hasRights('comment.moderate')) { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } // deliberate fall-through // deliberate fall-through case 'edit': $retval .= CMT_handleEdit($commentmode, $postmode, $format, $order, $cpage); if ($is_comment_page) { $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG03[1])); } break; case 'unsubscribe': $cid = 0; $key = COM_applyFilter($_GET['key']); if (!empty($key)) { $key = DB_escapeString($key); $cid = DB_getItem($_TABLES['commentnotifications'], 'cid', "deletehash = '{$key}'"); if (!empty($cid)) { $redirecturl = $_CONF['site_url'] . '/comment.php?mode=view&cid=' . $cid . '&format=nested&msg=16'; DB_delete($_TABLES['commentnotifications'], 'deletehash', $key, $redirecturl); exit; } } echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; break; case $LANG_ADMIN['cancel']: if ($formtype == 'editsubmission') { echo COM_refresh($_CONF['site_admin_url'] . '/moderation.php'); exit; } else { $retval .= CMT_handleCancel(); // moved to function for readibility } break; default: // New Comment or Reply Comment $abort = false; // Check to make sure comment type exists if ($type != 'article' && !in_array($type, $_PLUGINS)) { $abort = true; } // Check article permissions if (!$abort && $type == 'article' && !empty($sid)) { $dbTitle = DB_getItem($_TABLES['stories'], 'title', "(sid = '{$sid}') AND (draft_flag = 0) AND (date <= NOW()) AND (commentcode = 0)" . COM_getPermSQL('AND')); // if ($dbTitle === null || TOPIC_hasMultiTopicAccess('article', $sid) < 2) { // Make sure have at least read access to topics to post comment if ($dbTitle === null || TOPIC_hasMultiTopicAccess('article', $sid, $topic) < 2) { // Make sure have at least read access to current topic of article to post comment // no permissions, or no story of that title $abort = true; } } if (!$abort && !empty($sid) && !empty($type)) { 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'); // Check title, if for some reason blank assume no access allowed to plugin item (therefore cannot add comment) so return to homepage if (is_array($title) || empty($title) || $title == false) { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } $title = str_replace('$', '$', $title); // CMT_commentForm expects non-htmlspecial chars for title... $title = str_replace('&', '&', $title); $title = str_replace('"', '"', $title); $title = str_replace('<', '<', $title); $title = str_replace('>', '>', $title); } $retval .= CMT_commentForm($title, '', $sid, $pid, $type, $commentmode, $postmode, $format, $order, $cpage); } else { if (COMMENT_ON_SAME_PAGE) { // Do nothing and do not show comment form (happens most likely when admin viewing draft article) } else { // For comments not displayed on same page (probably owner pushed the post comment button on a draft article) echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } } if ($is_comment_page) { $noindex = '<meta name="robots" content="noindex"' . XHTML . '>'; $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG03[1], 'headercode' => $noindex)); } break; } return $retval; }
$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; }
/** * 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; }
function MG_displayMedia($id, $full = 0, $sortOrder = 0, $comments = 0, $spage = 0) { global $_TABLES, $_CONF, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_MG04, $LANG_ACCESS, $_USER; $retval = ''; $aid = DB_getItem($_TABLES['mg_media_albums'], 'album_id', 'media_id="' . addslashes($id) . '"'); require_once $_CONF['path'] . 'plugins/mediagallery/include/classAlbum.php'; $mg_album = new mgAlbum($aid); $root_album = new mgAlbum(0); $pid = 0; if (isset($mg_album->pid)) { $pid = $mg_album->pid; } $aOffset = -1; $aOffset = $mg_album->getOffset(); if ($aOffset == -1 || $mg_album->access == 0) { $retval = COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . '<br' . XHTML . '>' . $LANG_MG00['access_denied_msg'] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); return array($LANG_MG00['access_denied_msg'], $retval); } $sql = MG_buildMediaSql(array('album_id' => $aid, 'sortorder' => $mg_album->enable_sort ? $sortOrder : 0)); $result = DB_query($sql); $nRows = DB_numRows($result); $total_media = $nRows; $media_array = array(); while ($row = DB_fetchArray($result)) { $media_array[] = $row; $id_array[] = $row['media_id']; } $key = array_search($id, $id_array); if ($key === false) { $retval = COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . '<br' . XHTML . '>' . $LANG_MG00['access_denied_msg'] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); return array($LANG_MG00['access_denied_msg'], $retval); } $media = $media_array[$key]; if ($mg_album->full == 2 || $_MG_CONF['discard_original'] == 1 || $mg_album->full == 1 && $_USER['uid'] > 1) { $full = 0; } $disp = $full ? 'orig' : 'disp'; if ($mg_album->enable_comments == 0) { $comments = 0; } $display_skin = $mg_album->display_skin; MG_getCSS($display_skin); // construct the album jumpbox... $album_jumpbox = ''; if (!$_MG_CONF['hide_jumpbox_on_mediaview']) { $album_jumpbox = MG_buildAlbumJumpbox($root_album, $aid, 1, -1); } // Update the views count... But only for non-admins if (!$root_album->owner_id) { $media_views = $media['media_views'] + 1; DB_change($_TABLES['mg_media'], 'media_views', $media_views, 'media_id', addslashes($media['media_id'])); } $columns_per_page = $mg_album->display_columns == 0 ? $_MG_CONF['ad_display_columns'] : $mg_album->display_columns; $rows_per_page = $mg_album->display_rows == 0 ? $_MG_CONF['ad_display_rows'] : $mg_album->display_rows; $_MG_USERPREFS = MG_getUserPrefs(); if (isset($_MG_USERPREFS['display_rows']) && $_MG_USERPREFS['display_rows'] > 0) { $rows_per_page = $_MG_USERPREFS['display_rows']; } if (isset($_MG_USERPREFS['display_columns']) && $_MG_USERPREFS['display_columns'] > 0) { $columns_per_page = $_MG_USERPREFS['display_columns']; } $media_per_page = $columns_per_page * $rows_per_page; if ($mg_album->albums_first) { $childCount = $mg_album->getChildCount(); $page = intval(($key + $childCount) / $media_per_page) + 1; } else { $page = intval($key / $media_per_page) + 1; } /* * check to see if the original image exists, if not fall back to full image */ $media_size_orig = @getimagesize(Media::getFilePath('orig', $media['media_filename'], $media['media_mime_ext'])); if ($media_size_orig == false) { $full = 0; $disp = 'disp'; } $aPage = intval($aOffset / ($root_album->display_columns * $root_album->display_rows)) + 1; $birdseed = MG_getBirdseed($mg_album->id, 1, $sortOrder, $aPage); $album_link = '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $aid . '&page=' . $page . '&sort=' . $sortOrder . '">'; if ($_MG_CONF['usage_tracking']) { MG_updateUsage('media_view', $mg_album->title, $media['media_title'], $media['media_id']); } // hack for tga files... if ($media['mime_type'] == 'image/x-targa' || $media['mime_type'] == 'image/tga') { $full = 0; $disp = 'disp'; } $prevLink = ''; $nextLink = ''; $pagination = ''; $base_url = $_MG_CONF['site_url'] . "/media.php?f=" . ($full ? '1' : '0') . "&sort=" . $sortOrder; list($prevLink, $nextLink) = MG_getNextandPrev($base_url, $nRows, $key, $media_array); // generate pagination routine if (!empty($prevLink)) { $pagination .= '<a href="' . $prevLink . '">' . $LANG_MG03['previous'] . '</a>'; } if (!empty($nextLink)) { $pagination .= !empty($prevLink) ? ' ' : ''; $pagination .= '<a href="' . $nextLink . '">' . $LANG_MG03['next'] . '</a>'; } $pagination .= LB; // hack for testing...>>> $media_id = $media['media_id']; if ($_MG_CONF['click_image_and_go_next'] && !$_MG_CONF['full_in_popup']) { $nextkey = MG_getNextitem($nRows, $key); if ($nextkey !== '') { $media_id = $media_array[$nextkey]['media_id']; } } $vf = $full; if ($media['media_type'] == '0') { // image $switch_size = $_MG_CONF['site_url'] . "/media.php?f=" . ($full ? '0' : '1') . '&sort=' . $sortOrder . '&s=' . $media['media_id']; $lang_switch_size = $full ? $LANG_MG03['normal_size'] : $LANG_MG03['full_size']; $switch_viewsize_link = '<a href="' . $switch_size . '">' . $lang_switch_size . '</a>'; } // hack for testing...<<< $opt = array('full' => $full, 'media_id' => $media_id, 'sortOrder' => $sortOrder, 'spage' => $spage, 'playback_type' => $mg_album->playback_type, 'skin' => $mg_album->skin, 'display_skin' => $mg_album->display_skin, 'allow_download' => $mg_album->allow_download, 'full_display' => $mg_album->full); list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_buildContent($media, $opt); $mid = $media['media_id']; if ($_MG_CONF['use_upload_time'] == 1) { $media_date = MG_getUserDateTimeFormat($media['upload_time']); } else { $media_date = MG_getUserDateTimeFormat($media['media_time']); } $rating_box = ''; if ($mg_album->enable_rating > 0) { require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-rating.php'; $rating_box = MG_getRatingBar($mg_album->enable_rating, $media['media_user_id'], $media['media_id'], $media['media_votes'], $media['media_rating'], ''); } $download_link = ''; $download = ''; if ($mg_album->allow_download) { $download_link = $_MG_CONF['site_url'] . '/download.php?mid=' . $media['media_id']; $download = '<a href="' . $download_link . '">' . $LANG_MG01['download'] . '</a>'; } $edit_item_link = ''; $edit_item = ''; if ($mg_album->access == 3 || $_MG_CONF['allow_user_edit'] == true && isset($_USER['uid']) && $media['media_user_id'] == $_USER['uid']) { $edit_item_link = $_MG_CONF['site_url'] . '/admin.php?mode=mediaedit&s=1&album_id=' . $aid . '&mid=' . $mid; $edit_item = '<a href="' . $edit_item_link . '">' . $LANG_MG01['edit'] . '</a>'; } $media_desc = PLG_replaceTags(nl2br($media['media_desc'])); if (strlen($media_desc) > 0) { $media_desc = '<p style="margin:5px">' . $media_desc . '</p>'; } $getid3link = ''; $getid3linkend = ''; $media_properties = $getid3link != '' ? $LANG_MG03['media_properties'] : ''; $kwText = ''; $lang_keywords = ''; 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); }
function MG_displayMediaImage($mediaObject, $full, $sortOrder, $comments, $sortID = 0, $spage = 0) { global $MG_albums, $_TABLES, $_CONF, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_MG04, $LANG_ACCESS, $LANG01, $album_jumpbox, $glversion, $_USER, $_MG_USERPREFS; global $_DB_dbms, $LANG04, $ratedIds; $retval = ''; $media_link_start = ''; $media_link_end = ''; $srcID = $mediaObject; $outputHandle = outputHandler::getInstance(); $aid = DB_getItem($_TABLES['mg_media_albums'], 'album_id', 'media_id="' . DB_escapeString($mediaObject) . '"'); if (isset($MG_albums[$aid]->pid)) { $pid = $MG_albums[$aid]->pid; } else { $pid = 0; } if (@method_exists($MG_albums[$aid], 'getOffset')) { $aOffset = $MG_albums[$aid]->getOffset(); } else { $aOffset = -1; } if ($aOffset == -1 || $MG_albums[$aid]->access == 0) { $retval .= COM_showMessageText($LANG_MG00['access_denied_msg'], $LANG_ACCESS['accessdenied'], true); return array($LANG_MG00['access_denied_msg'], $retval); } $mid = $mediaObject; $orderBy = MG_getSortOrder($aid, $sortOrder); $sql = "SELECT * FROM {$_TABLES['mg_media_albums']} as ma LEFT JOIN " . $_TABLES['mg_media'] . " as m " . " ON ma.media_id=m.media_id WHERE ma.album_id=" . $aid . $orderBy; $result = DB_query($sql); $nRows = DB_numRows($result); $total_media = $nRows; $media = array(); while ($row = DB_fetchArray($result)) { $media[] = $row; $ids[] = $row['media_id']; } $key = array_search($mid, $ids); if ($key === false) { $retval .= COM_showMessageText($LANG_MG00['access_denied_msg'], $LANG_ACCESS['accessdenied'], true); return array($LANG_MG00['access_denited_msg'], $retval); } $mediaObject = $key; if ($MG_albums[$aid]->full == 2 || $_MG_CONF['discard_original'] == 1 || $MG_albums[$aid]->full == 1 && COM_isAnonUser()) { $full = 0; } if ($full) { $disp = 'orig'; } else { $disp = 'disp'; } if ($MG_albums[$aid]->enable_comments == 0) { $comments = 0; } if ($sortID > 0) { $MG_albums[$aid]->enable_slideshow = 0; } $themeCSS = ''; $nFrame = new mgFrame(); $nFrame->constructor($MG_albums[$aid]->display_skin); $MG_albums[$aid]->displayFrameTemplate = $nFrame->getTemplate(); $MG_albums[$aid]->dfrWidth = $nFrame->frame['wHL'] + $nFrame->frame['wHR']; $MG_albums[$aid]->dfrHeight = $nFrame->frame['hVT'] + $nFrame->frame['hVB']; $themeCSS = $nFrame->getCSS(); if ($themeCSS != '') { $outputHandle->addStyle($themeCSS); $themeCSS = ''; } $T = new Template(MG_getTemplatePath($aid)); switch ($media[$mediaObject]['media_type']) { case '0': // image $T->set_file('page', 'view_image.thtml'); $ogType = 'article'; break; case '1': // video // video case '5': // embedded video $meta_file_name = $_MG_CONF['path_mediaobjects'] . 'orig/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . '.' . $media[$mediaObject]['media_mime_ext']; COM_errorLog("DEBUG: Video File: " . $meta_file_name); $meta = IMG_getMediaMetaData($_MG_CONF['path_mediaobjects'] . 'orig/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . '.' . $media[$mediaObject]['media_mime_ext']); COM_errorLog("DEBUG: Video Meta Type: " . $meta['mime_type']); if ($meta['mime_type'] == 'video/quicktime') { if ($meta['fileformat'] == 'mp4') { $media[$mediaObject]['mime_type'] = 'video/mp4'; } } $T->set_file('page', 'view_video.thtml'); $ogType = 'video.movie'; break; case '2': // audio $T->set_file('page', 'view_audio.thtml'); $ogType = 'music.song'; break; default: $T->set_file('page', 'view_image.thtml'); $ogType = 'article'; break; } $ptitle = isset($media[$mediaObject]['media_title']) && $media[$mediaObject]['media_title'] != ' ' ? PLG_replaceTags($media[$mediaObject]['media_title'], 'mediagallery', 'media_title') : ''; $permalink = COM_buildUrl($_MG_CONF['site_url'] . '/media.php?s=' . $srcID); $outputHandle->addLink("canonical", $permalink); $outputHandle->addMeta('property', 'og:title', $ptitle); $outputHandle->addMeta('property', 'og:type', $ogType); $outputHandle->addMeta('property', 'og:url', $permalink); $T->set_var('permalink', $permalink); $T->set_file(array('shutterfly' => 'digibug.thtml')); $T->set_var('header', $LANG_MG00['plugin']); $T->set_var('site_url', $_MG_CONF['site_url']); $T->set_var('plugin', 'mediagallery'); // construct the album jumpbox... $level = 0; $album_jumpbox = '<form name="jumpbox" action="' . $_MG_CONF['site_url'] . '/album.php' . '" method="get" style="margin:0;padding:0"><div>'; $album_jumpbox .= $LANG_MG03['jump_to'] . ': <select name="aid" onchange="forms[\'jumpbox\'].submit()">'; $MG_albums[0]->buildJumpBox($aid); $album_jumpbox .= '</select>'; $album_jumpbox .= ' <input type="submit" value="' . $LANG_MG03['go'] . '"/>'; $album_jumpbox .= '<input type="hidden" name="page" value="1"/>'; $album_jumpbox .= '</div></form>'; // Update the views count... But only for non-admins if (!$MG_albums[0]->owner_id) { $media_views = $media[$mediaObject]['media_views'] + 1; DB_query("UPDATE " . $_TABLES['mg_media'] . " SET media_views=" . $media_views . " WHERE media_id='" . DB_escapeString($media[$mediaObject]['media_id']) . "'"); } $columns_per_page = $MG_albums[$aid]->display_columns == 0 ? $_MG_CONF['ad_display_columns'] : $MG_albums[$aid]->display_columns; $rows_per_page = $MG_albums[$aid]->display_rows == 0 ? $_MG_CONF['ad_display_rows'] : $MG_albums[$aid]->display_rows; if (isset($_MG_USERPREFS['display_rows']) && $_MG_USERPREFS['display_rows'] > 0) { $rows_per_page = $_MG_USERPREFS['display_rows']; } if (isset($_MG_USERPREFS['display_columns']) && $_MG_USERPREFS['display_columns'] > 0) { $columns_per_page = $_MG_USERPREFS['display_columns']; } $media_per_page = $columns_per_page * $rows_per_page; if ($MG_albums[$aid]->albums_first) { $childCount = $MG_albums[$aid]->getChildCount(); $page = intval(($mediaObject + $childCount) / $media_per_page) + 1; } else { $page = intval($mediaObject / $media_per_page) + 1; } /* * check to see if the original image exists, if not fall back to full image */ $media_size_orig = @getimagesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . '.' . $media[$mediaObject]['media_mime_ext']); if ($media_size_orig == false) { $full = 0; $disp = 'disp'; } $aPage = intval($aOffset / ($_MG_CONF['album_display_columns'] * $_MG_CONF['album_display_rows'])) + 1; if ($sortID > 0) { $birdseed = '<a href="' . $_CONF['site_url'] . '/index.php">' . $LANG_MG03['home'] . '</a> ' . ($_MG_CONF['gallery_only'] == 1 ? '' : $_MG_CONF['seperator'] . ' <a href="' . $_MG_CONF['site_url'] . '/index.php?page=' . $aPage . '">' . $_MG_CONF['menulabel'] . '</a> ') . $_MG_CONF['seperator'] . '<a href="' . $_MG_CONF['site_url'] . '/search.php?id=' . $sortID . '&page=' . $spage . '">' . $LANG_MG03['search_results'] . '</a>'; $MG_albums[$aid]->getPath(1, $sortOrder, $page) . '</a>'; $birdseed_ul = '<li><a href="' . $_CONF['site_url'] . '/index.php">' . $LANG_MG03['home'] . '</a></li>' . '<li><a href="' . $_MG_CONF['site_url'] . '/index.php?page=' . $aPage . '">' . $_MG_CONF['menulabel'] . '</a></li>' . '<li><a href="' . $_MG_CONF['site_url'] . '/search.php?id=' . $sortID . '&page=' . $spage . '">' . $LANG_MG03['search_results'] . '</a></li>' . $MG_albums[$aid]->getPath_ul(1, $sortOrder, $page) . '</a>'; $album_link = '<a href="' . $_MG_CONF['site_url'] . '/search.php?id=' . $sortID . '&page=' . $spage . '">'; } else { $birdseed = '<a href="' . $_CONF['site_url'] . '/index.php">' . $LANG_MG03['home'] . '</a> ' . ($_MG_CONF['gallery_only'] == 1 ? '' : $_MG_CONF['seperator'] . ' <a href="' . $_MG_CONF['site_url'] . '/index.php?page=' . $aPage . '">' . $_MG_CONF['menulabel'] . '</a> ') . $MG_albums[$aid]->getPath(1, $sortOrder, $page) . '</a>'; $birdseed_ul = '<li><a href="' . $_CONF['site_url'] . '/index.php">' . $LANG_MG03['home'] . '</a></li>' . '<li><a href="' . $_MG_CONF['site_url'] . '/index.php?page=' . $aPage . '">' . $_MG_CONF['menulabel'] . '</a></li>' . $MG_albums[$aid]->getPath_ul(1, $sortOrder, $page) . '</a>'; $album_link = '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $aid . '&page=' . $page . '&sort=' . $sortOrder . '">'; } mg_usage('media_view', $MG_albums[$aid]->title, $media[$mediaObject]['media_title'], $media[$mediaObject]['media_id']); // hack for tga files... if ($media[$mediaObject]['mime_type'] == 'image/x-targa' || $media[$mediaObject]['mime_type'] == 'image/tga') { $full = 0; $disp = 'disp'; } switch ($media[$mediaObject]['mime_type']) { case 'video/x-ms-asf': case 'video/x-ms-asf-plugin': case 'video/avi': case 'video/msvideo': case 'video/x-msvideo': case 'video/avs-video': case 'video/x-ms-wmv': case 'video/x-ms-wvx': case 'video/x-ms-wm': case 'application/x-troff-msvideo': case 'application/x-ms-wmz': case 'application/x-ms-wmd': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayASF($aid, $media[$mediaObject], $full); break; case 'audio/x-ms-wma': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayMP3($aid, $media[$mediaObject], $full); break; case 'video/mp4': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayMP4($aid, $media[$mediaObject], $full); break; case 'video/mpeg': case 'video/x-mpeg': case 'video/x-mpeq2a': if ($_MG_CONF['use_wmp_mpeg'] == 1) { list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayASF($aid, $media[$mediaObject], $full); break; } case 'video/x-motion-jpeg': case 'video/quicktime': case 'video/x-qtc': case 'video/x-m4v': if ($media[$mediaObject]['media_mime_ext'] == 'mp4' && isset($_MG_CONF['play_mp4_flv']) && $_MG_CONF['play_mp4_flv'] == true) { list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayFLV($aid, $media[$mediaObject], $full); } else { list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayMOV($aid, $media[$mediaObject], $full); } break; case 'embed': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayEmbed($aid, $media[$mediaObject], $full, $mediaObject); break; case 'application/x-shockwave-flash': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displaySWF($aid, $media[$mediaObject], $full); break; case 'video/x-flv': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayFLV($aid, $media[$mediaObject], $full); break; case 'audio/mpeg': case 'audio/x-mpeg': case 'audio/mpeg3': case 'audio/x-mpeg-3': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayMP3($aid, $media[$mediaObject], $full); break; case 'application/ogg': case 'application/x-ogg': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayOGG($aid, $media[$mediaObject], $full); break; case 'image/x-targa': case 'image/tga': case 'image/tiff': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayTGA($aid, $media[$mediaObject], $full, $mediaObject); break; case 'image/photoshop': case 'image/x-photoshop': case 'image/psd': case 'application/photoshop': case 'application/psd': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayPSD($aid, $media[$mediaObject], $full, $mediaObject); break; case 'image/gif': case 'image/jpeg': case 'image/jpg': case 'image/png': case 'image/bmp': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url, $media_link_start, $media_link_end) = MG_displayJPG($aid, $media[$mediaObject], $full, $media[$mediaObject]['media_id'], $sortOrder, $sortID, $spage); break; default: switch ($media[$mediaObject]['media_mime_ext']) { case 'jpg': case 'gif': case 'png': case 'bmp': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url, $media_link_start, $media_link_end) = MG_displayJPG($aid, $media[$mediaObject], $full, $media[$mediaObject]['media_id'], $sortOrder, $sortID, $spage); break; case 'asf': list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayASF($aid, $media[$mediaObject], $full); break; default: list($u_image, $raw_image, $raw_image_width, $raw_image_height, $raw_link_url) = MG_displayGeneric($aid, $media[$mediaObject], $full, $media[$mediaObject]['media_id'], $sortOrder); break; } } $mid = $media[$mediaObject]['media_id']; $media_date = MG_getUserDateTimeFormat($media[$mediaObject]['media_time']); $upload_date = MG_getUserDateTimeFormat($media[$mediaObject]['media_upload_time']); // build the rating bar if rating is enabled. if ($MG_albums[$aid]->enable_rating > 0) { $uid = COM_isAnonUser() ? 1 : $_USER['uid']; $static = false; $voted = 0; // check to see if we are the owner, if so, no rating for us... if (isset($_USER['uid']) && $_USER['uid'] == $media[$mediaObject]['media_user_id']) { $static = true; $voted = 0; } else { if (in_array($media[$mediaObject]['media_id'], $ratedIds)) { $static = true; $voted = 1; } else { $static = 0; $voted = 0; } } if ($MG_albums[$aid]->enable_rating == 1 && COM_isAnonUser()) { $static = true; $voted = 0; } $rating_box = RATING_ratingBar('mediagallery', $media[$mediaObject]['media_id'], $media[$mediaObject]['media_votes'], $media[$mediaObject]['media_rating'], $voted, 5, $static, ''); } else { $rating_box = ''; } $T->set_var('rating_box', $rating_box); if ($MG_albums[$aid]->allow_download) { $T->set_var(array('download' => '<a href="' . $_MG_CONF['site_url'] . '/download.php?mid=' . $media[$mediaObject]['media_id'] . '">' . $LANG_MG01['download'] . '</a>')); } if ($media[$mediaObject]['media_type'] == 0 && $MG_albums[$aid]->enable_shutterfly) { $media_size_orig = false; $media_size_tn = false; if ($_MG_CONF['discard_original'] == 1) { foreach ($_MG_CONF['validExtensions'] as $ext) { if (file_exists($_MG_CONF['path_mediaobjects'] . 'disp/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext)) { $sf_picture = $_MG_CONF['mediaobjects_url'] . '/disp/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext; $media_size_orig = @getimagesize($_MG_CONF['path_mediaobjects'] . 'disp/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext); break; } } } else { foreach ($_MG_CONF['validExtensions'] as $ext) { if (file_exists($_MG_CONF['path_mediaobjects'] . 'orig/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext)) { $sf_picture = $_MG_CONF['mediaobjects_url'] . '/orig/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext; $media_size_orig = @getimagesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext); break; } } } foreach ($_MG_CONF['validExtensions'] as $ext) { if (file_exists($_MG_CONF['path_mediaobjects'] . 'tn/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext)) { $tnImage = $_MG_CONF['mediaobjects_url'] . '/tn/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext; $media_size_tn = @getimagesize($_MG_CONF['path_mediaobjects'] . 'tn/' . $media[$mediaObject]['media_filename'][0] . '/' . $media[$mediaObject]['media_filename'] . $ext); break; } } $outputHandle->addMeta('property', 'og:image', $tnImage); if ($media_size_orig != false && $media_size_tn != false) { $T->set_var(array('sf_height' => $media_size_orig[1], 'sf_width' => $media_size_orig[0], 'sf_tn_height' => $media_size_tn[1], 'sf_tn_width' => $media_size_tn[0], 'sf_thumbnail' => $tnImage, 'sf_picture' => $sf_picture, 'sf_title' => $media[$mediaObject]['media_title'], 'lang_print_digibug' => $LANG_MG03['print_digibug'], 'lang_print_shutterfly' => $LANG_MG03['print_shutterfly'])); $T->parse('shutterfly_submit', 'shutterfly'); } } if ($MG_albums[$aid]->access == 3 || $_MG_CONF['allow_user_edit'] == true && isset($_USER['uid']) && $media[$mediaObject]['media_user_id'] == $_USER['uid']) { $edit_item = '<a href="' . $_MG_CONF['site_url'] . '/admin.php?mode=mediaedit&s=1&album_id=' . $aid . '&mid=' . $mid . '">' . $LANG_MG01['edit'] . '</a>'; } else { $edit_item = ''; } $media_desc = PLG_replaceTags(nl2br($media[$mediaObject]['media_desc']), 'mediagallery', 'media_description'); if (strlen($media_desc) > 0) { USES_lib_html2text(); $metaDesc = $media_desc; $metaDesc = strip_tags($metaDesc); $html2txt = new html2text($metaDesc, false); $metaDesc = trim($html2txt->get_text()); $shortComment = ''; $metaArray = explode(' ', $metaDesc); $wordCount = count($metaArray); $lengthCount = 0; $tailString = ''; foreach ($metaArray as $word) { $lengthCount = $lengthCount + strlen($word); $shortComment .= $word . ' '; if ($lengthCount >= 100) { $tailString = '...'; break; } } $metaDesc = trim($shortComment) . $tailString; $outputHandle->addMeta('name', 'description', htmlspecialchars($metaDesc, ENT_QUOTES, COM_getEncodingt())); $media_desc .= '<br/><br/>'; } // start of the lightbox slideshow code if ($MG_albums[$aid]->enable_slideshow == 2) { $lbSlideShow = '<noscript><div class="pluginAlert">' . $LANG04[150] . '</div></noscript>' . LB; $lbSlideShow .= '<script type="text/javascript">' . LB; $lbSlideShow .= 'function openGallery1() {' . LB; $lbSlideShow .= ' return loadXMLDoc("' . $_MG_CONF['site_url'] . '/lightbox.php?aid=' . $aid . '");'; $lbSlideShow .= '}' . LB; $lbSlideShow .= '</script>' . LB; $T->set_var('lbslideshow', $lbSlideShow); } else { $T->set_var('lbslideshow', ''); } // end of the lightbox slideshow code switch ($MG_albums[$aid]->enable_slideshow) { case 0: $url_slideshow = ''; break; case 1: $url_slideshow = '<a href="' . $_MG_CONF['site_url'] . '/slideshow.php?aid=' . $aid . '&sort=' . $sortOrder . '"><b>' . $LANG_MG03['slide_show'] . '</b></a>'; break; case 2: $lbss_count = DB_count($_TABLES['mg_media'], 'media_type', 0); $sql = "SELECT COUNT(m.media_id) as lbss_count FROM {$_TABLES['mg_media_albums']} as ma INNER JOIN " . $_TABLES['mg_media'] . " as m " . " ON ma.media_id=m.media_id WHERE m.media_type = 0 AND ma.album_id=" . $aid; $res = DB_query($sql); list($lbss_count) = DB_fetchArray($res); if ($lbss_count != 0) { $url_slideshow = '<span id="mgslideshow" class="jsenabled_show" style="display:none"><a href="#" onclick="return openGallery1()"><b>' . $LANG_MG03['slide_show'] . '</b></a></span>'; } else { $MG_albums[$aid]->enable_slideshow = 0; } break; case 3: $url_slideshow = '<a href="' . $_MG_CONF['site_url'] . '/fslideshow.php?aid=' . $aid . '&src=disp"><b>' . $LANG_MG03['slide_show'] . '</b></a>'; break; case 4: $url_slideshow = '<a href="' . $_MG_CONF['site_url'] . '/fslideshow.php?aid=' . $aid . '&src=orig"><b>' . $LANG_MG03['slide_show'] . '</b></a>'; break; } $prevLink = ''; $nextLink = ''; list($prevLink, $nextLink) = $sortID > 0 ? array('', '') : MG_getNextandPrev($_MG_CONF['site_url'] . "/media.php?f=" . ($full ? '1' : '0') . "&sort=" . $sortOrder, $nRows, 1, $mediaObject, $media, TRUE); $T->set_var(array('birdseed' => $birdseed, 'birdseed_ul' => $birdseed_ul, 'slide_show' => isset($url_slideshow) ? $url_slideshow : '', 'image_detail' => $u_image, 'border_height' => $raw_image_height + 30, 'border_width' => $raw_image_width + 30, 'media_title' => isset($media[$mediaObject]['media_title']) && $media[$mediaObject]['media_title'] != ' ' ? PLG_replaceTags($media[$mediaObject]['media_title'], 'mediagallery', 'media_title') : '', 'album_title' => $sortID > 0 ? $LANG_MG03['search_results'] : $MG_albums[$aid]->title, 'media_desc' => isset($media[$mediaObject]['media_desc']) && $media[$mediaObject]['media_desc'] != ' ' ? $media_desc : '', 'artist' => isset($media[$mediaObject]['artist']) ? $media[$mediaObject]['artist'] : '', 'media_time' => $media_date[0], 'upload_time' => $upload_date[0], 'media_views' => $MG_albums[$aid]->enable_views ? $media[$mediaObject]['media_views'] : '', 'media_comments' => $MG_albums[$aid]->enable_comments ? $media[$mediaObject]['media_comments'] . '<br />' : '', 'pagination' => $sortID > 0 ? '' : generate_pic_pagination($_MG_CONF['site_url'] . "/media.php?f=" . ($full ? '1' : '0') . "&sort=" . $sortOrder, $nRows, 1, $mediaObject, $media, TRUE), 'media_number' => sprintf("%s %d %s %d", $LANG_MG03['image'], $mediaObject + 1, $LANG_MG03['of'], $total_media), 'jumpbox' => $album_jumpbox, 'edit_item' => $edit_item, 'site_url' => $_MG_CONF['site_url'], '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, 'media_link_start' => $media_link_start, 'media_link_end' => $media_link_end, 'raw_link_url' => $raw_link_url, 'album_link' => $MG_albums[$aid]->getPath(1, $sortOrder, $page), 'item_number' => $mediaObject + 1, 'total_items' => $total_media, 'lang_of' => $LANG_MG03['of'], 'album_link' => $album_link)); $getid3link = ''; $getid3linkend = ''; $T->set_var(array('getid3' => $getid3link, 'getid3end' => $getid3linkend)); if ($getid3link != '') { $T->set_var('media_properties', $LANG_MG03['media_properties']); } else { $T->set_var('media_properties', ''); } if ($MG_albums[$aid]->enable_keywords == 1 && !empty($media[$mediaObject]['media_keywords'])) { $kwText = ''; $keyWords = array(); $keyWords = explode(' ', $media[$mediaObject]['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> '; } $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); }
} if (!empty($lid)) { $permsql = $_DLM_CONF['has_edit_rights'] ? '' : COM_getPermSQL('AND', 0, 2, 'b'); $sql = "SELECT a.lid, a.cid, a.title, url, homepage, version, size, md5, logourl, mg_autotag, tags, a.owner_id, date, " . "hits, rating, votes, commentcode, project, description, detail, postmode, " . "imgurl, b.title AS cat_title " . "FROM {$_TABLES['downloads']} a " . "LEFT JOIN {$_TABLES['downloadcategories']} b ON a.cid=b.cid " . "WHERE a.lid='" . addslashes($lid) . "' " . "AND is_released=1 " . "AND date<={$now} " . $permsql; $result = DB_query($sql); if (DB_numRows($result) == 1) { $A = DB_fetchArray($result); dlformat($T, $A); $pathstring = "<a href=\"{$_CONF['site_url']}/downloads/index.php\">" . $LANG_DLM['main'] . "</a>" . BCSEPALATOR . $mytree->getNicePathFromId($A['cid'], "title", "{$_CONF['site_url']}/downloads/index.php"); $T->set_var('category_path_link', $pathstring); $T->set_var('cssid', 1); $T->set_var('project_filelist', makeProjectFileList($lid)); require_once $_CONF['path_system'] . 'lib-comment.php'; $A['title'] = str_replace(''', "'", $A['title']); $A['title'] = str_replace('&', '&', $A['title']); $T->set_var('comment_records', CMT_userComments($lid, $A['title'], 'downloads', $_POST['order'], $_POST['mode'], 0, 1, false, $_DLM_CONF['has_edit_rights'], $A['commentcode'])); if ($_DLM_CONF['show_tn_only_exists']) { if (empty($A['logourl'])) { $filedetail = $T->finish($T->parse('filelisting_records', 'filedetail_notn')); } else { $filedetail = $T->finish($T->parse('filelisting_records', 'filedetail')); } } else { $filedetail = $T->finish($T->parse('filelisting_records', 'filedetail')); } $display .= PLG_replaceTags($filedetail); $pagetitle .= ': ' . $A['title']; $display = DLM_createHTMLDocument($display, array('pagetitle' => $pagetitle)); COM_output($display); exit; }