if (!empty($template_default["article"]["div_spacer"])) { $CNT_TMP .= '<div style="margin-top:' . $crow["acontent_before"] . 'px;" class="' . $template_default['classes']['spaceholder-cp-before'] . '"></div>'; } else { $CNT_TMP .= '<br class="' . $template_default['classes']['spaceholder-cp-before'] . '" />' . spacer(1, $crow["acontent_before"]); } } // set frontend edit link if ($content['article_frontend_edit']) { $CNT_TMP .= getFrontendEditLink('CP', $crow['acontent_aid'], $crow['acontent_id']); } // include content part code section if ($crow["acontent_type"] != 30) { include PHPWCMS_ROOT . "/include/inc_front/content/cnt" . $crow["acontent_type"] . ".article.inc.php"; } elseif ($crow["acontent_type"] == 30 && is_file($phpwcms['modules'][$crow["acontent_module"]]['path'] . 'inc/cnt.article.php')) { if ($content['article_frontend_edit']) { $CNT_TMP .= getFrontendEditLink('module', $phpwcms['modules'][$crow["acontent_module"]]['name'], $crow['acontent_aid']); } // now try to include module content part code include $phpwcms['modules'][$crow["acontent_module"]]['path'] . 'inc/cnt.article.php'; } // check if top link should be shown $CNT_TMP .= getContentPartTopLink($crow["acontent_top"]); // Space after if ($crow["acontent_after"]) { if (!empty($template_default["article"]["div_spacer"])) { $CNT_TMP .= '<div style="margin-bottom:' . $crow["acontent_after"] . 'px;" class="' . $template_default['classes']['spaceholder-cp-after'] . '"></div>'; } else { $CNT_TMP .= '<br class="' . $template_default['classes']['spaceholder-cp-after'] . '" />' . spacer(1, $crow["acontent_after"]); } } // Maybe content part ID should b used inside templates or for something different
if (!empty($content['alink']['alink_type'])) { $content['alink']['alink_id'] = array(); foreach ($content['alink']['result'] as $value) { $content['alink']['alink_id'][] = $value['article_id']; } } // Max teaser items $content['alink']['max_items'] = count($content['alink']['alink_id']); foreach ($content['alink']['alink_id'] as $key => $value) { $content['UNIQUE_ALINK'][$value] = $value; //save UNIQUE Teaser ID foreach ($content['alink']['result'] as $row) { if ($value == $row['article_id'] && isset($content['struct'][$row['article_cid']])) { // enable frontend edit link if (FE_EDIT_LINK && ($_SESSION["wcs_user_admin"] || $_SESSION["wcs_user_id"] == $row["article_uid"])) { $content['alink']['tr'][$key] = getFrontendEditLink('summary', $row["article_id"]); } else { $content['alink']['tr'][$key] = ''; } // set columns/row class if ($content['alink']['alink_columns'] > 0) { // check if the current teaser will be on a new row if ($content['alink']['row_space'] && $content['alink']['alink_template_row']) { $content['alink']['tr'][$key] .= str_replace('{ROW}', $content['alink']['row'], $content['alink']['alink_template_row']); } $content['alink']['column_current'] = $content['alink']['column']; // now make the tests if ($content['alink']['column'] % $content['alink']['alink_columns']) { // New column $content['alink']['column']++; $content['alink']['row_space'] = false;
// if only 1 article for this category available // then show this article directly // sets article ID to this only 1 article foreach ($content["articles"] as $key => $value) { $aktion[1] = intval($key); break; } $aktion[4] = 1; // this needs to be set to 1 for showing the article // enable canonical <link> tag $content['set_canonical'] = true; } else { // there is more than 1 article inside this category //enym enable structure fe link for listing mode if (FE_EDIT_LINK && $_SESSION["wcs_user_admin"]) { $content["main"] .= getFrontendEditLink('structure', $content['cat_id']); } // -> list all - the 1st will be shown with summary and such stuff $content["main"] .= list_articles_summary(); } } else { $no_content_for_this_page = true; } } elseif ($content["article_list_count"] === 1) { // enable canonical <link> tag $content['set_canonical'] = true; } // Force 301 Redirect to structure alias if ($content['set_canonical'] && !empty($phpwcms['force301_2struct']) && !$content['aId_CpPage'] && empty($content['struct'][$aktion[0]]['acat_disable301']) && !empty($content['struct'][$aktion[0]]['acat_alias']) && (!defined('PHPWCMS_ALIAS') || PHPWCMS_ALIAS != $content['struct'][$aktion[0]]['acat_alias'])) { headerRedirect(abs_url(array(), array(), $content['struct'][$aktion[0]]['acat_alias'], 'urlencode'), 301); } elseif (count($_getVar) > 1) {
// start parsing news entries $news['row_count'] = 1; $news['total_count'] = 1; $news['entry_count'] = count($news['result']); // set new target if necessary if (empty($news['news_detail_link'])) { $news['base_href'] = rel_url($news['listing_page'], array('newsdetail')); } else { if (is_intval($news['news_detail_link'])) { $news['news_detail_link'] = 'aid=' . $news['news_detail_link']; } $news['base_href'] = rel_url($news['listing_page'], array('newsdetail'), $news['news_detail_link']); } foreach ($news['result'] as $key => $value) { $value['cnt_object'] = @unserialize($value['cnt_object']); $news['entries'][$key] = getFrontendEditLink('news', $value['cnt_id']); if (empty($value['cnt_object']['cnt_files']['gallery'])) { $news['tmpl_gallery_item'] = ''; $news['entries'][$key] .= $news['tmpl_entry']; } else { if (empty($news['tmpl_gallery_item'])) { $news['tmpl_gallery_item'] = get_tmpl_section('GALLERY_ITEM', $news['tmpl_entry']); } $news['entries'][$key] .= replace_tmpl_section('GALLERY_ITEM', $news['tmpl_entry']); } if ($value['cnt_teasertext']) { $value['cnt_opengraph_teasertext'] = $value['cnt_teasertext']; if ($news['config']['news_teaser_limit_chars']) { $value['cnt_teasertext'] = getCleanSubString($value['cnt_teasertext'], $news['config']['news_teaser_limit_chars'], $news['config']['news_teaser_limit_ellipse'], 'char'); } elseif ($news['config']['news_teaser_limit_words']) { $value['cnt_teasertext'] = getCleanSubString($value['cnt_teasertext'], $news['config']['news_teaser_limit_words'], $news['config']['news_teaser_limit_ellipse'], 'word');
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 showSelectedContent($param = '', $cpsql = null, $listmode = false) { global $template_default; global $db; global $content; global $block; global $phpwcms; global $aktion; $topcount = 999999; $template = ''; $param = is_array($param) && isset($param[1]) ? $param[1] : $param; $type = null; $mode = null; $related_type = 'OR'; $where = ''; $not = array(); if ($cpsql === null) { if ($cp = explode(',', $param)) { $mode = strtoupper(trim($cp[0])); $type = substr($mode, 0, 2); if ($type === 'AS') { $mode = explode('|', $cp[0]); if (isset($mode[1])) { $mode[1] = trim($mode[1]); if (is_numeric($mode[1])) { $topcount = intval($mode[1]); } elseif (empty($mode[2]) && strlen($mode[1]) > 4 && ($mode[1] == 'default' || is_file(PHPWCMS_TEMPLATE . 'inc_cntpart/articlesummary/list/' . $mode[1]))) { $template = $mode[1]; } } if (isset($mode[2])) { $mode[2] = trim($mode[2]); if (is_numeric($mode[2])) { $topcount = intval($mode[2]); } elseif (strlen($mode[2]) > 4 && ($mode[2] == 'default' || is_file(PHPWCMS_TEMPLATE . 'inc_cntpart/articlesummary/list/' . $mode[2]))) { $template = $mode[2]; } } $mode = strtoupper(trim($mode[0])); if (isset($cp[1])) { // now check if $cp[1] = trim($cp[1]); if (!is_numeric($cp[1])) { $cp[1] = explode('|', $cp[1], 2); // Check for OR or AND if (isset($cp[1][1])) { $related_type = strtoupper(trim($cp[1][1])); if ($related_type !== 'AND' && $related_type !== 'OR') { $related_type = 'OR'; } } $cp[1] = trim($cp[1][0]); switch ($cp[1]) { case 'random': $where = 'RANDOM'; break; case 'related': if (isset($cp[2])) { unset($cp[0], $cp[1]); $related = array(); foreach ($cp as $value) { $related[] = "article_keyword LIKE " . _dbEscape(strtoupper(trim($value)), true, '%', '%'); } if (count($related)) { $where = '(' . implode(' ' . $related_type . ' ', $related) . ')'; } } break; case 'new': default: $where = 'NEW'; break; } $not[] = $aktion[1]; $cp = array(); } } } if (count($cp)) { unset($cp[0]); foreach ($cp as $key => $value) { $value = intval($value); if (!$value) { unset($cp[$key]); } else { $cp[$key] = $value; } } if (!count($cp)) { return ''; } } } else { // oh no ID given, end function return ''; } } elseif (is_string($cpsql)) { // Otherwise custom SQL // and fallback to CPC mode $type = 'CP'; $mode = 'CPC'; $cp = array(0); } $CNT_TMP = ''; // Article Mode if ($type === 'AS') { if (substr($mode, -1) == 'P') { $mode = substr($mode, 0, -1); $priorize = 'article_priorize DESC, '; } else { $priorize = ''; } switch ($mode) { case 'ASL': $sort = $priorize . 'article_begin ASC'; break; // sorted by livedate ascending // sorted by livedate ascending case 'ASLD': $sort = $priorize . 'article_begin DESC'; break; // sorted by livedate descending // sorted by livedate descending case 'ASK': $sort = $priorize . 'article_end ASC'; break; // sorted by killdate ascending // sorted by killdate ascending case 'ASKD': $sort = $priorize . 'article_end DESC'; break; // sorted by killdate descending // sorted by killdate descending case 'ASC': $sort = $priorize . 'article_tstamp ASC'; break; // sorted by change date ascending // sorted by change date ascending case 'ASCD': $sort = $priorize . 'article_tspamp DESC'; break; // sorted by change date descending // sorted by change date descending case 'AST': $sort = $priorize . 'article_keyword ASC'; break; // sorted by keyword ascending // sorted by keyword ascending case 'ASTD': $sort = $priorize . 'article_keyword DESC'; break; // sorted by keyword descending // sorted by keyword descending case 'ASR': $sort = 'RAND()'; break; // random sort // random sort default: $sort = ''; } $CNT_TMP = list_articles_summary(get_article_data($cp, $topcount, $sort, $where, $not), $topcount, $template); // Content Part mode CP, CPA, CPAD, CPS, CPAS, CPASD } elseif ($type === 'CP') { $sort = $mode == 'CPAD' || $mode == 'CPASD' ? ' DESC' : ''; //means ASCENDING foreach ($cp as $value) { if ($mode == 'CP') { // content part listing $sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_articlecontent "; $sql .= "INNER JOIN " . DB_PREPEND . "phpwcms_article ON "; $sql .= DB_PREPEND . "phpwcms_article.article_id=" . DB_PREPEND . "phpwcms_articlecontent.acontent_aid "; $sql .= "WHERE acontent_id=" . $value . " AND acontent_visible=1 "; $sql .= "AND acontent_block NOT IN ('CPSET', 'SYSTEM') "; if (!FEUSER_LOGIN_STATUS) { $sql .= 'AND acontent_granted=0 '; } $sql .= "AND acontent_trash=0 AND " . DB_PREPEND . "phpwcms_article.article_deleted=0 "; if (!PREVIEW_MODE) { $sql .= ' AND ' . DB_PREPEND . "phpwcms_article.article_begin < NOW() AND " . DB_PREPEND . "phpwcms_article.article_end > NOW() "; } $sql .= "LIMIT 1"; } elseif ($mode == 'CPS') { $sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_articlecontent "; $sql .= "INNER JOIN " . DB_PREPEND . "phpwcms_article ON "; $sql .= DB_PREPEND . "phpwcms_article.article_id=" . DB_PREPEND . "phpwcms_articlecontent.acontent_aid "; $sql .= "WHERE acontent_id=" . $value . " AND acontent_visible=1 "; $sql .= "AND acontent_block='SYSTEM' "; if (!FEUSER_LOGIN_STATUS) { $sql .= 'AND acontent_granted=0 '; } $sql .= "AND acontent_trash=0 AND " . DB_PREPEND . "phpwcms_article.article_deleted=0 "; if (!PREVIEW_MODE) { $sql .= ' AND ' . DB_PREPEND . "phpwcms_article.article_begin < NOW() AND " . DB_PREPEND . "phpwcms_article.article_end > NOW() "; } $sql .= "LIMIT 1"; } elseif ($mode == 'CPC') { $sql = $cpsql; } else { // content parts based on article ID $sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_articlecontent "; $sql .= "WHERE acontent_aid=" . $value . " AND acontent_visible=1 AND acontent_trash=0 "; if ($mode == 'CPAS' || $mode == 'CPASD') { $sql .= "AND acontent_block='SYSTEM' "; } else { $sql .= "AND acontent_block NOT IN ('CPSET', 'SYSTEM') "; } if (!FEUSER_LOGIN_STATUS) { $sql .= 'AND acontent_granted=0 '; } $sql .= "ORDER BY acontent_sorting" . $sort . ", acontent_id"; } if (!empty($sql) && ($cresult = mysql_query($sql, $db))) { while ($crow = mysql_fetch_assoc($cresult)) { if ($crow["acontent_type"] == 30 && !isset($phpwcms['modules'][$crow["acontent_module"]])) { continue; } if ($crow["acontent_type"] == 24) { // first retrieve alias ID information and settings $crow = getContentPartAlias($crow); if ($crow === false) { continue; } } // Set listmode setting, allows fallback listmode content part template // for content parts which supports it (ToDo extend it) $crow['acontent_template_listmode'] = $listmode; $space = getContentPartSpacer($crow["acontent_before"], $crow["acontent_after"]); // Space before $CNT_TMP .= $space['before']; // set frontend edit link $CNT_TMP .= getFrontendEditLink('CP', $crow['acontent_aid'], $crow['acontent_id']); // include content part code section if ($crow["acontent_type"] != 30) { include PHPWCMS_ROOT . '/include/inc_front/content/cnt' . $crow["acontent_type"] . '.article.inc.php'; } elseif ($crow["acontent_type"] == 30 && file_exists($phpwcms['modules'][$crow["acontent_module"]]['path'] . 'inc/cnt.article.php')) { $CNT_TMP .= getFrontendEditLink('module', $phpwcms['modules'][$crow["acontent_module"]]['name'], $crow['acontent_aid']); // now try to include module content part code include $phpwcms['modules'][$crow["acontent_module"]]['path'] . 'inc/cnt.article.php'; } //check if top link should be shown $CNT_TMP .= getContentPartTopLink($crow["acontent_top"]); //Maybe content part ID should b used inside templates or for something different $CNT_TMP = str_replace(array('[%CPID%]', '{CPID}'), $crow["acontent_id"], $CNT_TMP); // trigger content part functions $CNT_TMP = trigger_cp($CNT_TMP, $crow); // Space after $CNT_TMP .= $space['after']; } mysql_free_result($cresult); } } } if (empty($phpwcms["allow_cntPHP_rt"]) || empty($phpwcms['enable_inline_php'])) { $CNT_TMP = remove_unsecure_rptags($CNT_TMP); } return trim($CNT_TMP); }