$content['alink']['tr'][$key] .= $content['alink']['alink_template_space']; } $content['alink']['column_current'] = $content['alink']['column']; $content['alink']['column']++; //$content['alink']['column_minus'] = 1; $content['alink']['row_minus'] = 0; } $content['alink']['tr'][$key] .= $content['alink']['alink_template_entry']; $content['alink']['tr'][$key] = str_replace('{ARTICLEID}', $row['article_id'], $content['alink']['tr'][$key]); $content['alink']['tr'][$key] = str_replace('{CATEGORYID}', $row['article_cid'], $content['alink']['tr'][$key]); $content['alink']['tr'][$key] = str_replace('{COLUMN}', $content['alink']['column_current'], $content['alink']['tr'][$key]); $content['alink']['tr'][$key] = str_replace('{ROW}', $content['alink']['row'] - $content['alink']['row_minus'], $content['alink']['tr'][$key]); $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'MENUTITLE', html_specialchars($row['article_menutitle'])); $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'TITLE', html_specialchars($row['article_title'])); $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'SUBTITLE', html_specialchars($row['article_subtitle'])); $content['alink']['tr'][$key] = render_cnt_date($content['alink']['tr'][$key], $row[$content['alink']['date_basis']], phpwcms_strtotime($row['article_begin']), phpwcms_strtotime($row['article_end'])); $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'PRIO', empty($row['article_priorize']) ? '' : $row['article_priorize']); $content['alink']['tr'][$key] = render_cnt_template($content['alink']['tr'][$key], 'ACTIVE', isset($content["article_id"]) && $content["article_id"] == $row['article_id'] ? 'active' : ''); $row['article_image'] = @unserialize($row['article_image']); $row['article_image'] = setArticleSummaryImageData($row['article_image']); if (!empty($row['article_image']['list_caption'])) { $content['alink']['caption'] = getImageCaption($row['article_image']['list_caption']); $row['article_image']['list_caption'] = html_specialchars($content['alink']['caption'][0]); $content['alink']['caption'][3] = html_specialchars($content['alink']['caption'][3]); $content['alink']['caption'][1] = html_specialchars($content['alink']['caption'][1]); } else { $row['article_image']['list_caption'] = ''; $content['alink']['caption'] = array('', '', '', '', ''); } // article list image if (strpos($content['alink']['tr'][$key], 'IMAGE') !== false) {
// Search for all system related content parts $sql_cnt = 'SELECT * FROM ' . DB_PREPEND . 'phpwcms_articlecontent WHERE acontent_aid=' . $content["article_id"] . ' '; $sql_cnt .= "AND acontent_visible=1 AND acontent_trash=0 AND acontent_block='SYSTEM' AND acontent_tid IN (2, 3) "; // 2 = article detail, 3 = article detail OR list if (!FEUSER_LOGIN_STATUS) { $sql_cnt .= 'AND acontent_granted=0 '; } $sql_cnt .= "ORDER BY acontent_sorting, acontent_id"; $row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'SYSTEM', showSelectedContent('CPC', $sql_cnt)); } else { $row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'SYSTEM', ''); } $row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'IMAGE', $thumb_img); $row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'CAPTION', nl2br(html_specialchars($row["article_image"]["caption"]))); $row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'COPYRIGHT', html_specialchars($row["article_image"]["copyright"])); $row["article_image"]['tmplfull'] = render_cnt_date($row["article_image"]['tmplfull'], $content["article_date"], $row['article_livedate'], $row['article_killdate']); $row["article_image"]['tmplfull'] = render_cnt_template($row["article_image"]['tmplfull'], 'ZOOMIMAGE', $popup_img); $content["summary"] .= $row["article_image"]['tmplfull']; $row["article_image"]['tmplfull'] = 1; } else { $row["article_image"]['tmplfull'] = 0; } if ($content["summary"]) { $content["main"] .= $content["summary"]; $content["main"] .= $template_default["article"]["head_after"]; } // render content parts $sql_cnt = "SELECT * FROM " . DB_PREPEND . "phpwcms_articlecontent WHERE acontent_aid=" . $row["article_id"] . " "; $sql_cnt .= "AND acontent_visible=1 AND acontent_trash=0 "; if (!FEUSER_LOGIN_STATUS) { $sql_cnt .= 'AND acontent_granted=0 ';
function parse($item, $type = 'GALLERY_ITEM') { if ($type === 'GALLERY_ITEM') { $entry = $this->list_template; $name = html($item['f_name']); $link = $this->url . '&gallery=' . $item['f_id']; $title = $this->list_title_prefix . $name . $this->list_title_suffix; $descr = trim($item['f_longinfo']); if ($descr !== '') { $descr = $this->list_descr_prefix . plaintext_htmlencode($descr) . $this->list_descr_suffix; } $thumbs = array(); // get preview/thumbnail image(s) for this gallery if ($this->list_thumbnail > 0) { $temp_limit = $this->image_limit; $temp_sort = $this->image_sort; $this->image_limit = $this->list_thumbnail; $this->image_sort = 'DESC'; $this->getImages($item['f_id']); foreach ($this->images as $image) { $img = '<img src="'; $img .= $this->image_src . $this->list_thumbnail_width . 'x' . $this->list_thumbnail_height; if ($this->list_thumbnail_crop == 1) { $img .= 'x1'; } $img .= '/' . $image['f_hash'] . '.' . $image['f_ext']; $img .= '" alt="' . $name . '" border="0" />'; $thumbs[] = $this->list_thumbnail_prefix . $img . $this->list_thumbnail_suffix; } $this->image_limit = $temp_limit; $this->image_sort = $temp_sort; } $thumbs = implode(LF, $thumbs); $entry = str_replace('{TITLE}', $title, $entry); $entry = str_replace('{DESCRIPTION}', $descr, $entry); $entry = str_replace('{THUMBNAIL}', $thumbs, $entry); $entry = str_replace('[/LINK]', '</a>', $entry); $entry = str_replace('[LINK]', '<a href="' . $link . '" title="' . $name . '">', $entry); $entry = render_cnt_date($entry, $item['f_created']); return $this->parseGeneral($entry); } }
if (strpos($content["all"], '[PRINT]') !== false) { $content["all"] = str_replace('[PRINT]', '<a href="' . rel_url(array('print' => 1), array(), PHPWCMS_ALIAS) . '" class="' . $template_default['classes']['link-print'] . '" target="_blank" rel="nofollow">', $content["all"]); $content["all"] = str_replace('[/PRINT]', '</a>', $content["all"]); } if (strpos($content["all"], '[PRINT_PDF]') !== false) { $content["all"] = str_replace('[PRINT_PDF]', '<a href="' . rel_url(array('print' => 2), array(), PHPWCMS_ALIAS) . '" class="' . $template_default['classes']['link-print-pdf'] . '" target="_blank" rel="nofollow">', $content["all"]); $content["all"] = str_replace('[/PRINT_PDF]', '</a>', $content["all"]); } // some article related "global" replacement tags if (isset($content['article_livedate'])) { $content['all'] = render_cnt_template($content['all'], 'AUTHOR', html_specialchars($content['article_username'])); $content['all'] = render_cnt_date($content['all'], $content["article_date"], $content['article_livedate'], $content['article_killdate']); $content['all'] = render_cnt_template($content['all'], 'CATEGORY', $content['cat']); } else { $content['all'] = render_cnt_template($content['all'], 'AUTHOR', ''); $content['all'] = render_cnt_date($content['all'], now(), now(), now()); $content['all'] = render_cnt_template($content['all'], 'CATEGORY', html_specialchars($content['struct'][$content['cat_id']]['acat_name'])); } // render JavaScript Plugins and/or JavaScript scripts that should be loaded in <head> $content['all'] = preg_replace_callback('/<!--\\s+JS:(.*?)\\s+-->/s', 'renderHeadJS', $content['all']); $content['all'] = preg_replace_callback('/<!--\\s+CSS:(.*?)\\s+-->/s', 'renderHeadCSS', $content['all']); // test for frontend.js if (!isset($GLOBALS['block']['custom_htmlhead']['frontend.js']) && preg_match('/MM_swapImage|BookMark_Page|clickZoom|mailtoLink/', $content['all'])) { initFrontendJS(); } //check for additional template based onLoad JavaScript Code if ($block["jsonload"]) { if (empty($pagelayout["layout_jsonload"])) { $pagelayout["layout_jsonload"] = ''; } else { $pagelayout["layout_jsonload"] .= ';';
$value['image_url'] = get_redirect_link($value['cnt_object']['cnt_image']['link'], ' ', ''); $news['entries'][$key] = str_replace('{IMAGE_URL_TARGET}', $value['image_url']['target'], $news['entries'][$key]); $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'IMAGE_URL', html_specialchars($value['image_url']['link'])); } // Check for Zoom $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'ZOOM', empty($value['cnt_object']['cnt_image']['zoom']) ? '' : 'zoom'); // news entry URL $value['news_url'] = $value['cnt_object']['cnt_link'] == '' ? array('link' => '', 'target' => '') : get_redirect_link($value['cnt_object']['cnt_link'], ' ', ''); $news['entries'][$key] = str_replace('{URL_TARGET}', $value['news_url']['target'], $news['entries'][$key]); if (is_numeric($value['news_url']['link']) && intval($value['news_url']['link'])) { $value['news_url']['link'] = 'index.php?aid=' . intval($value['news_url']['link']); } $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'URL', html_specialchars($value['news_url']['link'])); $news['entries'][$key] = render_cnt_template($news['entries'][$key], 'URL_TEXT', html_specialchars($value['cnt_object']['cnt_linktext'])); // Dates $news['entries'][$key] = render_cnt_date($news['entries'][$key], $value['cnt_changed'], $value['cnt_ts_livedate'], $value['cnt_ts_killdate']); $news['entries'][$key] = render_date($news['entries'][$key], $value['cnt_ts_sortdate'], 'SORTDATE'); $news['files_result'] = ''; // Files if (isset($value['cnt_object']['cnt_files']['id']) && is_array($value['cnt_object']['cnt_files']['id']) && count($value['cnt_object']['cnt_files']['id'])) { // should image files used for gallery if (!empty($value['cnt_object']['cnt_files']['gallery']) && strpos($news['entries'][$key], '/GALLERY')) { if (!$news['config']['gallery_allowed_ext']) { $value['cnt_object']['cnt_files']['gallery'] = false; // Get Image files } else { $value['cnt_object']['cnt_files']['where'] = 'f_id IN (' . implode(',', $value['cnt_object']['cnt_files']['id']) . ') AND '; $value['cnt_object']['cnt_files']['where'] .= 'f_public=1 AND f_aktiv=1 AND f_kid=1 AND f_trash=0 AND '; $value['cnt_object']['cnt_files']['where'] .= 'f_ext IN(' . $news['config']['gallery_allowed_ext'] . ')'; $value['cnt_object']['cnt_files']['images'] = _dbGet('phpwcms_file', 'f_id,f_hash,f_name,f_ext,f_longinfo,f_copyright,f_vars', $value['cnt_object']['cnt_files']['where']); if (!isset($value['cnt_object']['cnt_files']['images'][0])) {
$order_process = str_replace('{ITEMS}', implode(LF . LF, $cart_items), $order_process); include $phpwcms['modules']['shop']['path'] . 'inc/cart.parse.inc.php'; $order_process = str_replace('{ORDER}', $order_num, $order_process); $order_process = render_cnt_date($order_process, time()); $mail_customer = @html_entity_decode($order_process); // prepare new order mail $order_process = $_tmpl['mail_neworder']; foreach ($_SESSION[CART_KEY]['step1'] as $item_key => $row) { $order_process = render_cnt_template($order_process, $item_key, html($row)); } $cart_mode = 'mail1'; include $phpwcms['modules']['shop']['path'] . 'inc/cart.items.inc.php'; $order_process = str_replace('{ITEMS}', implode(LF . LF, $cart_items), $order_process); include $phpwcms['modules']['shop']['path'] . 'inc/cart.parse.inc.php'; $order_process = str_replace('{ORDER}', $order_num, $order_process); $order_process = render_cnt_date($order_process, time()); $mail_neworder = @html_entity_decode($order_process); if (!empty($_SESSION[CART_KEY]['payby'])) { $payment = $_SESSION[CART_KEY]['payby']; $mail_customer = render_cnt_template($mail_customer, 'PAYBY_' . strtoupper($payment), $_tmpl['config']['label_payby_' . $payment]); $mail_neworder = render_cnt_template($mail_neworder, 'PAYMENT', $_tmpl['config']['label_payby_' . $payment]); } else { $mail_customer = render_cnt_template($mail_customer, 'PAYBY_' . strtoupper($payment), 'n.a.'); $mail_neworder = render_cnt_template($mail_neworder, 'PAYMENT', 'n.a.'); $payment = 'n.a.'; } if ($subtotal['shipping_calc_type'] === 2) { $mail_customer = render_cnt_template($mail_customer, 'SHIPPING_DISTANCE', number_format($subtotal['shipping_distance'] / 1000, 1, $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep'])); $mail_neworder = render_cnt_template($mail_neworder, 'SHIPPING_DISTANCE', number_format($subtotal['shipping_distance'] / 1000, 1, $_tmpl['config']['dec_point'], $_tmpl['config']['thousands_sep'])); $mail_customer = str_replace('{SHIPPING_DISTANCE_LABEL}', $subtotal['shipping_distance_details']['label'], $mail_customer); $mail_neworder = str_replace('{SHIPPING_DISTANCE_LABEL}', $subtotal['shipping_distance_details']['label'], $mail_neworder);
function list_articles_summary($alt = NULL, $topcount = 99999, $template = '') { // returns an article listing only with headline and summary text // and with an listing of all other available articles of this category global $content; global $template_default; global $_getVar; // alternative way to send article listings if (is_array($alt)) { // first save default value of $content["articles"] $_old_articles = $content["articles"]; $content["articles"] = $alt; $temp_topcount = intval($topcount); if ($temp_topcount == 0) { $temp_topcount = $content['struct'][$content['cat_id']]['acat_topcount']; } $template = trim($template); } else { $temp_topcount = $content['struct'][$content['cat_id']]['acat_topcount']; } $max_articles = count($content["articles"]); if (empty($template_default['article_paginate_show'])) { $paginate_show = array('bottom' => 1); } else { $paginate_show = array(); foreach (explode(' ', $template_default['article_paginate_show']) as $value) { if ($value == 'top') { $paginate_show['top'] = 1; } elseif ($value == 'bottom') { $paginate_show['bottom'] = 1; } elseif (strpos($value, 'rt') !== false) { $paginate_show['rt'] = str_replace('rt', '', $value); } } if (!count($paginate_show)) { $paginate_show = array('bottom' => 1); } } if ($content['struct'][$content['cat_id']]['acat_paginate'] && $content['struct'][$content['cat_id']]['acat_maxlist'] && $max_articles > $content['struct'][$content['cat_id']]['acat_maxlist']) { $paginate = true; $paginate_navi = empty($template_default['article_paginate_navi']) ? '<div class="' . $template_default['classes']['article-list-paginate'] . '">{PREV:«} {NEXT:»}</div>' : $template_default['article_paginate_navi']; $max_pages = ceil($max_articles / $content['struct'][$content['cat_id']]['acat_maxlist']); // always do full top article listing because of paginating $temp_topcount = $max_articles + 1; if (isset($_getVar['listpage'])) { $page_current = intval($_getVar['listpage']); if ($page_current < 1) { $page_current = 1; } elseif ($page_current > $max_pages) { $page_current = $max_pages; } } else { $page_current = 1; } $page_next = $page_current; $page_prev = $page_current; if ($page_current < $max_pages) { $page_next = $page_current + 1; } if ($page_current > 1) { $page_prev = $page_current - 1; } // setting pagination navi $page_article_max = $content['struct'][$content['cat_id']]['acat_maxlist'] * $page_current; $page_article_at = $content['struct'][$content['cat_id']]['acat_maxlist'] * ($page_current - 1); $page_article_at = $page_article_at + 1; if ($page_article_max > $max_articles) { $page_article_max = $max_articles; } $paginate_navi = str_replace('#####', $max_articles, $paginate_navi); $paginate_navi = str_replace('####', $page_article_max, $paginate_navi); $paginate_navi = str_replace('###', $page_article_at, $paginate_navi); $paginate_navi = str_replace('##', $max_pages, $paginate_navi); $paginate_navi = str_replace('#', $page_current, $paginate_navi); $GLOBALS['paginate_temp'] = array('next' => '', 'prev' => '', 'navi' => ''); $paginate_navi = preg_replace_callback('/\\{NEXT:(.*?)\\}/', 'get_PaginateNext', $paginate_navi); $paginate_navi = preg_replace_callback('/\\{PREV:(.*?)\\}/', 'get_PaginatePrevious', $paginate_navi); $paginate_navi = preg_replace_callback('/\\{NAVI:(.*?)\\}/', 'get_PaginateNavigate', $paginate_navi); // next page link if ($GLOBALS['paginate_temp']['next'] && $page_current < $max_pages) { $_getVar['listpage'] = $page_next; $page_next_link = '<a href="' . rel_url() . '">' . $GLOBALS['paginate_temp']['next'] . '</a>'; } else { $page_next_link = $GLOBALS['paginate_temp']['next']; } // previous page link if ($GLOBALS['paginate_temp']['prev'] && $page_current > 1) { $_getVar['listpage'] = $page_prev; $page_prev_link = '<a href="' . rel_url() . '">' . $GLOBALS['paginate_temp']['prev'] . '</a>'; } else { $page_prev_link = $GLOBALS['paginate_temp']['prev']; } // set listpage value to current page $paginate_navi = str_replace('{NEXT}', $page_next_link, $paginate_navi); $paginate_navi = str_replace('{PREV}', $page_prev_link, $paginate_navi); // temporary unset GET listpage setting unset($_getVar['listpage']); if ($GLOBALS['paginate_temp']['navi']) { $navi = explode(',', $GLOBALS['paginate_temp']['navi'], 2); $navi[0] = trim($navi[0]); $navi[1] = empty($navi[1]) ? array(0 => ' ') : explode('|', $navi[1]); $navi['spacer'] = empty($navi[1][0]) ? ' ' : $navi[1][0]; //spacer $navi['prefix'] = empty($navi[1][1]) ? '' : $navi[1][1]; //prefix $navi['suffix'] = empty($navi[1][2]) ? '' : $navi[1][2]; //suffix $navi['navi'] = $navi['prefix']; if ($navi[0] == '123') { for ($i = 1; $i <= $max_pages; $i++) { if ($i > 1) { $navi['navi'] .= $navi['spacer']; } $navi['navi'] .= $i == $page_current ? $i : '<a href="' . rel_url(array('listpage' => $i)) . '">' . $i . '</a>'; } } elseif ($navi[0] == '1-3') { for ($i = 0; $i < $max_pages; $i++) { $i_start = $i * $content['struct'][$content['cat_id']]['acat_maxlist'] + 1; $i_end = $i_start - 1 + $content['struct'][$content['cat_id']]['acat_maxlist']; if ($i_end > $max_articles) { $i_end = $max_articles; } if ($i > 0) { $navi['navi'] .= $navi['spacer']; } $i_entry = $i_start . '–' . $i_end; $i_page = $i + 1; $navi['navi'] .= $i_page == $page_current ? $i_entry : '<a href="' . rel_url(array('listpage' => $i_page)) . '">' . $i_entry . '</a>'; } } $navi['navi'] .= $navi['suffix']; // replace navi $paginate_navi = str_replace('{NAVI}', $navi['navi'], $paginate_navi); } // reset GET listpage setting $_getVar['listpage'] = $page_current; unset($GLOBALS['paginate_temp']); } else { $paginate = false; $paginate_navi = ''; } $tmpllist = array(); //temporary array for storing templates to minimize load $temp_counter = 0; $space_counter = 0; $listing = $template_default["space_top"]; //start with space at top if (isset($paginate_show['top'])) { $listing .= str_replace('{POS}', 'top', $paginate_navi); } foreach ($content["articles"] as $article) { if ($paginate && $content['struct'][$content['cat_id']]['acat_maxlist']) { // get page number based on current article counter $page_article = ceil(($temp_counter + 1) / $content['struct'][$content['cat_id']]['acat_maxlist']); if ($page_article > $page_current) { //stop listing break; } elseif ($page_article != $page_current) { //no listing - goto next article $temp_counter++; continue; } } $link_data = get_article_morelink($article); $article_link = $link_data[0]; //add available keywords to page wide keyword field $content['all_keywords'] .= $article["article_keyword"] . ','; if ($temp_counter < $temp_topcount) { // as long as the counter is lower than the default "top_count" value // show the complete article summary listing $article["article_image"] = setArticleSummaryImageData($article["article_image"]); if ($template) { $article["article_image"]['tmpllist'] = $template; } // build image/image link $article["article_image"]["poplink"] = ''; $thumb_image = false; $thumb_img = ''; $img_thumb_name = ''; $img_thumb_rel = ''; $img_thumb_abs = ''; $img_thumb_width = 0; $img_thumb_height = 0; $img_thumb_ext = 'jpg'; $img_zoom_name = ''; $img_zoom_rel = ''; $img_zoom_abs = ''; $img_zoom_width = 0; $img_zoom_height = 0; if (empty($article["article_image"]["list_caption"])) { $article["article_image"]["list_caption"] = ''; } $caption = getImageCaption($article["article_image"]["list_caption"]); $article["article_image"]["list_caption"] = $caption[0]; // caption text $article["article_image"]["copyright"] = $caption[4]; // copyright information $article["article_image"]["list_alt"] = $caption[1]; // alt text $article["article_image"]["list_title"] = $caption[3]; // title text if (!empty($article["article_image"]["list_hash"])) { $thumb_image = get_cached_image(array("target_ext" => $article["article_image"]['list_ext'], "image_name" => $article["article_image"]['list_hash'] . '.' . $article["article_image"]['list_ext'], "max_width" => $article["article_image"]['list_width'], "max_height" => $article["article_image"]['list_height'], "thumb_name" => md5($article["article_image"]['list_hash'] . $article["article_image"]['list_width'] . $article["article_image"]['list_height'] . $GLOBALS['phpwcms']["sharpen_level"] . $GLOBALS['phpwcms']['colorspace']))); if ($thumb_image != false) { $img_thumb_name = $thumb_image[0]; $img_thumb_rel = PHPWCMS_IMAGES . $thumb_image[0]; $img_thumb_abs = PHPWCMS_URL . PHPWCMS_IMAGES . $thumb_image[0]; $img_thumb_width = $thumb_image[1]; $img_thumb_height = $thumb_image[2]; $img_thumb_ext = $article["article_image"]['list_ext']; $caption[3] = empty($caption[3]) ? '' : ' title="' . html_specialchars($caption[3]) . '"'; $caption[1] = html_specialchars($caption[1]); $thumb_img = '<img src="' . PHPWCMS_IMAGES . $thumb_image[0] . '" ' . $thumb_image[3] . ' alt="' . $caption[1] . '"' . $caption[3] . ' class="' . $GLOBALS['template_default']['classes']['image-thumb'] . '" />'; if ($article["article_image"]["list_zoom"]) { $zoominfo = get_cached_image(array("target_ext" => $article["article_image"]['list_ext'], "image_name" => $article["article_image"]['list_hash'] . '.' . $article["article_image"]['list_ext'], "max_width" => $GLOBALS['phpwcms']["img_prev_width"], "max_height" => $GLOBALS['phpwcms']["img_prev_height"], "thumb_name" => md5($article["article_image"]['list_hash'] . $GLOBALS['phpwcms']["img_prev_width"] . $GLOBALS['phpwcms']["img_prev_height"] . $GLOBALS['phpwcms']["sharpen_level"] . $GLOBALS['phpwcms']['colorspace']))); if ($zoominfo != false) { $img_zoom_name = $zoominfo[0]; $img_zoom_rel = PHPWCMS_IMAGES . $zoominfo[0]; $img_zoom_abs = PHPWCMS_URL . PHPWCMS_IMAGES . $zoominfo[0]; $img_zoom_width = $zoominfo[1]; $img_zoom_height = $zoominfo[2]; $article["article_image"]["poplink"] = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]); if (!empty($caption[2][0])) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $article["article_image"]["poplink"]; $return_false = 'return false;'; } if (empty($article["article_image"]["list_lightbox"]) && !empty($caption[2][0])) { initFrontendJS(); $article["article_image"]["poplink"] = '<a href="' . $article["article_image"]["poplink"] . '" '; $article["article_image"]["poplink"] .= 'onclick="checkClickZoom();clickZoom(\'' . $open_link; $article["article_image"]["poplink"] .= "','previewpic','width=" . $zoominfo[1]; $article["article_image"]["poplink"] .= ",height=" . $zoominfo[2] . "');" . $return_false; $article["article_image"]["poplink"] .= '"' . $caption[2][1] . ' class="' . $GLOBALS['template_default']['classes']['image-zoom'] . '">'; } else { // lightbox initSlimbox(); $article["article_image"]["poplink"] = '<a href="' . PHPWCMS_IMAGES . $zoominfo[0] . '" rel="lightbox" '; if ($article["article_image"]["list_caption"]) { $article["article_image"]["poplink"] .= 'title="' . parseLightboxCaption($article["article_image"]["list_caption"]) . '" '; } $article["article_image"]["poplink"] .= 'class="' . $GLOBALS['template_default']['classes']['image-lightbox'] . '">'; } $article["article_image"]["poplink"] .= $thumb_img . '</a>'; } } unset($caption); } } else { $article["article_image"]["list_id"] = 0; $article["article_image"]["list_hash"] = ''; } // set default template if (empty($article["article_image"]['tmpllist']) || $article["article_image"]['tmpllist'] == 'default') { $article["article_image"]['tmpllist'] = 'default'; if (empty($tmpllist['default'])) { $tmpllist['default'] = file_get_contents(PHPWCMS_TEMPLATE . 'inc_default/article_summary_list.tmpl'); } } // try to read the template files // 1. try to check if template was read if (!isset($tmpllist[$article["article_image"]['tmpllist']])) { $tmpllist[$article["article_image"]['tmpllist']] = @file_get_contents(PHPWCMS_TEMPLATE . 'inc_cntpart/articlesummary/list/' . $article["article_image"]['tmpllist']); } if ($tmpllist[$article["article_image"]['tmpllist']]) { // set frontend edit link if (FE_EDIT_LINK && ($_SESSION["wcs_user_admin"] || $_SESSION["wcs_user_id"] == $article["article_uid"])) { $tmpl = getFrontendEditLink('summary', $article['article_id']); } else { $tmpl = ''; } //rendering $tmpl .= $tmpllist[$article["article_image"]['tmpllist']]; $tmpl = render_cnt_template($tmpl, 'TITLE', empty($article['article_notitle']) ? html_specialchars($article["article_title"]) : ''); $tmpl = render_cnt_template($tmpl, 'SUB', html_specialchars($article["article_subtitle"])); // replace thumbnail and zoom image information $tmpl = str_replace(array('{THUMB_NAME}', '{THUMB_REL}', '{THUMB_ABS}', '{THUMB_WIDTH}', '{THUMB_HEIGHT}', '{IMAGE_NAME}', '{IMAGE_REL}', '{IMAGE_ABS}', '{IMAGE_WIDTH}', '{IMAGE_HEIGHT}', '{IMAGE_ID}', '{IMAGE_HASH}', '{IMAGE_EXT}'), array($img_thumb_name, $img_thumb_rel, $img_thumb_abs, $img_thumb_width, $img_thumb_height, $img_zoom_name, $img_zoom_rel, $img_zoom_abs, $img_zoom_width, $img_zoom_height, $article["article_image"]["list_id"], $article["article_image"]["list_hash"], $img_thumb_ext), $tmpl); if (preg_match('/\\{SUMMARY:(\\d+)\\}/', $tmpl, $matches)) { if (empty($article['article_image']['list_maxwords'])) { $article['article_image']['list_maxwords'] = intval($matches[1]); } $tmpl = preg_replace('/\\{SUMMARY:\\d+\\}/', '{SUMMARY}', $tmpl); } if (strpos($article["article_summary"], '-//-')) { $article["article_summary"] = explode('-//-', $article["article_summary"]); $article['article_image']['list_maxwords_temp'] = count(preg_split("/[\\s,]+/", $article["article_summary"][0], -1, PREG_SPLIT_NO_EMPTY)); if (empty($article['article_image']['list_maxwords']) || $article['article_image']['list_maxwords_temp'] < $article['article_image']['list_maxwords']) { $article['article_image']['list_maxwords'] = $article['article_image']['list_maxwords_temp']; $article["article_summary"] = trim($article["article_summary"][0]); } else { $article["article_summary"] = implode(' ', $article["article_summary"]); } } $tmpl = render_cnt_template($tmpl, 'SUMMARY', empty($article['article_image']['list_maxwords']) ? $article["article_summary"] : getCleanSubString($article["article_summary"], abs($article['article_image']['list_maxwords']), $template_default['ellipse_sign'], $article['article_image']['list_maxwords'] < 0 ? 'char' : 'word', true)); // Render SYSTEM if (strpos($tmpl, '[SYSTEM]') !== false) { // Search for all system related content parts $sql_cnt = 'SELECT * FROM ' . DB_PREPEND . 'phpwcms_articlecontent WHERE acontent_aid=' . $article["article_id"] . ' '; $sql_cnt .= "AND acontent_visible=1 AND acontent_trash=0 AND acontent_block='SYSTEM' AND acontent_tid IN (1, 3) "; // 1 = article list, 3 = article detail OR list if (!FEUSER_LOGIN_STATUS) { $sql_cnt .= 'AND acontent_granted=0 '; } $sql_cnt .= "ORDER BY acontent_sorting, acontent_id"; $tmpl = render_cnt_template($tmpl, 'SYSTEM', showSelectedContent('CPC', $sql_cnt, true)); } else { $tmpl = render_cnt_template($tmpl, 'SYSTEM', ''); } // article class based on keyword *CSS-classname* $article['article_class'] = get_css_keywords($article['article_keyword']); $article['article_class'] = count($article['article_class']) ? implode(' ', $article['article_class']) : ''; $tmpl = render_cnt_template($tmpl, 'CLASS', $article['article_class']); $tmpl = render_cnt_template($tmpl, 'IMAGE', $thumb_img); $tmpl = render_cnt_template($tmpl, 'ZOOMIMAGE', $article["article_image"]["poplink"]); $tmpl = render_cnt_template($tmpl, 'CAPTION', nl2br(html_specialchars($article["article_image"]["list_caption"]))); $tmpl = render_cnt_template($tmpl, 'ALT', html_specialchars($article["article_image"]["list_alt"])); $tmpl = render_cnt_template($tmpl, 'IMAGE_TITLE', html_specialchars($article["article_image"]["list_title"])); $tmpl = render_cnt_template($tmpl, 'COPYRIGHT', html_specialchars($article["article_image"]["copyright"])); $tmpl = render_cnt_template($tmpl, 'ARTICLELINK', $article["article_morelink"] ? $article_link : ''); $tmpl = render_cnt_template($tmpl, 'EDITOR', html_specialchars($article["article_username"])); $tmpl = render_cnt_template($tmpl, 'ARTICLEID', $article["article_id"]); $tmpl = render_cnt_template($tmpl, 'MORE', $article["article_morelink"] ? $template_default["top_readmore_link"] : ''); $tmpl = render_cnt_template($tmpl, 'TARGET', $article["article_morelink"] && $link_data[1] ? ' target="' . $link_data[1] . '"' : ''); $tmpl = render_cnt_template($tmpl, 'BEFORE', '<!--before//-->'); $tmpl = render_cnt_template($tmpl, 'AFTER', '<!--after//-->'); $tmpl = render_cnt_date($tmpl, $article["article_date"], $article["article_livedate"], $article["article_killdate"]); $tmpl = render_cnt_template($tmpl, 'SPACE', $space_counter ? '<!--space//-->' : ''); $listing .= $tmpl; $article["article_image"]['tmpllist'] = 1; } else { $article["article_image"]['tmpllist'] = 0; } } else { // if "top_count" value is equal or larger // show only the article headline listing if ($temp_counter && $temp_counter == $temp_topcount) { $listing .= $template_default["space_aftertop_text"]; } elseif ($temp_counter) { $listing .= $template_default["space_between_list"]; } $listing .= $template_default["list_headline_before"]; // set frontend edit link if (FE_EDIT_LINK && ($_SESSION["wcs_user_admin"] || $_SESSION["wcs_user_id"] == $article["article_uid"])) { $listing .= getFrontendEditLink('article', $article['article_id']); $listing .= getFrontendEditLink('summary', $article['article_id']); } $listing .= '<a href="' . $article_link . '" class="' . $GLOBALS['template_default']['classes']['link-article-listing'] . '">'; $listing .= $template_default["list_startimage"]; $listing .= html_specialchars($article["article_title"]); $listing .= '</a>' . $template_default["list_headline_after"]; } $temp_counter++; $space_counter++; } if (isset($paginate_show['bottom'])) { $listing .= str_replace('{POS}', 'bottom', $paginate_navi); } if (!empty($paginate_show['rt'])) { $content['globalRT'][$paginate_show['rt']] = $paginate_navi; } // restore original articles if (isset($_old_articles)) { $content["articles"] = $_old_articles; } $listing .= $template_default["space_bottom"]; //ends with space at bottom return $listing; }
function render() { $items = array('top' => array(), 'default' => array(), 'bottom' => array(), 'hide' => array()); $now = now(); foreach ($this->dates as $key => $date) { $url = ''; $target = ''; $href = $this->href ? $this->href . '&show_date=' . date('Y-m-d', $date['calendar_start_date']) . '_' . $date['calendar_id'] : ''; $itemgroup = 'default'; if ($date['calendar_range']) { $date['calendar_range_start_date'] = strtotime($date['calendar_range_start'] . ' ' . date('H:i', $date['calendar_start_date'])); $date['calendar_range_end_date'] = strtotime($date['calendar_range_end']); $expired_date = $this->expired === 'START' ? 'calendar_range_start_date' : 'calendar_range_end_date'; } else { $expired_date = $this->expired === 'START' ? 'calendar_start_date' : 'calendar_end_date'; } if ($this->expired !== '' && $date[$expired_date] < $now) { if ($this->expired === 'bottom' || $this->expired === 'top') { $itemgroup = $this->expired; } elseif ($this->expired === 'hide') { unset($this->dates[$key]); continue; } } if (!empty($date['calendar_refid'])) { $date['calendar_refid'] = get_redirect_link($date['calendar_refid'], ' ', ''); $date['calendar_refid']['link'] = trim($date['calendar_refid']['link']); $date['calendar_refid']['link'] = trim($date['calendar_refid']['link'], '#'); $target = $date['calendar_refid']['target']; if (is_intval($date['calendar_refid']['link'])) { $url = rel_url(array(), array(), 'aid=' . $date['calendar_refid']['link']); //'index.php?aid='.$date['calendar_refid']['link']; } elseif (strpos($date['calendar_refid']['link'], '://') || strpos($date['calendar_refid']['link'], '?') || strpos($date['calendar_refid']['link'], '.')) { $url = $date['calendar_refid']['link']; } elseif (!empty($date['calendar_refid']['link'])) { $url = rel_url(array(), array(), $date['calendar_refid']['link']); } } // Split title/type if ($this->gettype !== '') { $date['calendar_title'] = explode($this->gettype, $date['calendar_title'], 2); $date['calendar_type'] = empty($date['calendar_title'][1]) ? '' : trim($date['calendar_title'][1]); $date['calendar_title'] = trim($date['calendar_title'][0]); } else { $date['calendar_type'] = ''; } if ($date['calendar_teaser']) { if ($this->teaserwords) { $date['calendar_teaser'] = getCleanSubString($date['calendar_teaser'], $this->teaserwords, $GLOBALS['template_default']['ellipse_sign'], 'word'); } $date['calendar_teaser'] = plaintext_htmlencode($date['calendar_teaser']); } $items[$itemgroup][$key] = $this->template; $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'HREF', $href); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'URL', $url); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TARGET', $target); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TITLE', html_specialchars($date['calendar_title'])); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TYPE', $date['calendar_type'] ? html_specialchars($date['calendar_type']) : ''); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TEASER', $date['calendar_teaser']); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'TEXT', $date['calendar_text']); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'PLACE', html_specialchars($date['calendar_where'])); $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'ALLDAY', $date['calendar_allday'] ? ' ' : ''); // Detect if range date if ($date['calendar_range']) { $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'RANGEDATE', ' '); $items[$itemgroup][$key] = render_cnt_date($items[$itemgroup][$key], $date['calendar_range_start_date'], $date['calendar_range_start_date'], $date['calendar_range_end_date']); } else { $items[$itemgroup][$key] = render_cnt_template($items[$itemgroup][$key], 'RANGEDATE', ''); } $items[$itemgroup][$key] = render_cnt_date($items[$itemgroup][$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']); } if (!count($items['default']) && !count($items['top']) && !count($items['bottom'])) { $items['default'][] = str_replace('{CALENDAR_RESET}', $this->resetCalendarLink(), $this->no_calendar_item_found); } elseif ($this->expired && count($items[$this->expired])) { array_unshift($items[$this->expired], $this->expired_prefix); $items[$this->expired][] = $this->expired_suffix; if ($this->expired === 'top') { $items = implode(LF, $items['top']) . LF . implode(LF, $items['default']); } else { $items = implode(LF, $items['default']) . LF . implode(LF, $items['bottom']); } } else { $items = implode(LF, $items['default']); } return $items; }
} $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'TITLE', $rss_obj->get_title()); $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'DESCRIPTION', $rss_obj->get_description()); $c = 0; $rss['items'] = array(); foreach ($rss_obj->get_items() as $rssvalue) { // general item info $rss['items'][$c] = render_cnt_template($rss['template_ITEM'], 'LINK', $rssvalue->get_permalink()); $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'TITLE', $rssvalue->get_title()); $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'DESCRIPTION', $rssvalue->get_description()); $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'CONTENT', $rssvalue->get_content()); // author $rss['item_author'] = $rssvalue->get_author(); $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'AUTHOR', $rss['item_author'] ? $rss['item_author']->get_name() : ''); // item date $rss['items'][$c] = render_cnt_date($rss['items'][$c], $rssvalue->get_date('U')); // Thumbnail $rss['item_thumbnail'] = ''; if ($rss['enclosure'] = $rssvalue->get_enclosure()) { $rss['item_thumbnail'] = $rss['enclosure']->get_thumbnail(); if (!$rss['item_thumbnail'] && $rss['enclosure']->get_link()) { $rss['item_thumbnail'] = $rss['enclosure']->get_link(); if ($rss['item_thumbnail'] && ($rss['item_thumbnail_ext'] = which_ext($rss['item_thumbnail']))) { if (!in_array($rss['item_thumbnail_ext'], array('jpg', 'jpeg', 'png', 'gif'))) { $rss['item_thumbnail'] = ''; } } else { $rss['item_thumbnail'] = ''; } } }