function showPollImage($image, $zoom = 0) { $image_border = ' border="' . intval($GLOBALS["template_default"]["article"]["imagelist_border"]) . '"'; if (empty($GLOBALS["template_default"]["article"]["imagelist_imgclass"])) { $image_imgclass = ''; } else { $image_imgclass = ' class="' . $GLOBALS["template_default"]["article"]["imagelist_imgclass"] . '"'; } $thumb_image = get_cached_image(array("target_ext" => $image[3], "image_name" => $image[2] . '.' . $image[3], "max_width" => $image[4], "max_height" => $image[5], "thumb_name" => md5($image[2] . $image[4] . $image[5] . $GLOBALS['phpwcms']["sharpen_level"] . $GLOBALS['phpwcms']['colorspace']))); if ($zoom) { $zoominfo = get_cached_image(array("target_ext" => $image[3], "image_name" => $image[2] . '.' . $image[3], "max_width" => $GLOBALS['phpwcms']["img_prev_width"], "max_height" => $GLOBALS['phpwcms']["img_prev_height"], "thumb_name" => md5($image[2] . $GLOBALS['phpwcms']["img_prev_width"] . $GLOBALS['phpwcms']["img_prev_height"] . $GLOBALS['phpwcms']["sharpen_level"] . $GLOBALS['phpwcms']['colorspace']))); } $list_img_temp = '<img src="' . PHPWCMS_IMAGES . $thumb_image[0] . '" ' . $thumb_image[3] . $image_border . $image_imgclass . ' />'; if ($zoom && !empty($zoominfo)) { // if click enlarge the image $open_popup_link = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]); $open_link = $open_popup_link; $return_false = 'return false;'; $html .= "<a href=\"" . $open_link . "\" onclick=\"checkClickZoom();clickZoom('" . $open_popup_link . "','previewpic','width="; $html .= $zoominfo[1] . ",height=" . $zoominfo[2] . "');" . $return_false . '">'; $html .= $list_img_temp . "</a>"; } else { // if not click enlarge $html .= $list_img_temp; } return $html; }
$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 = which_ext($thumb_image[0]); $content['images']['article'] = array('name' => $row["article_image"]["name"], 'hash' => $row["article_image"]["hash"], 'ext' => $img_thumb_ext, 'image' => array('width' => $img_thumb_width, 'height' => $img_thumb_height, 'src' => $img_thumb_rel)); if ($row["article_image"]["zoom"]) { $zoominfo = get_cached_image(array("target_ext" => $row["article_image"]['ext'], "image_name" => $row["article_image"]['hash'] . '.' . $row["article_image"]['ext'], "max_width" => $phpwcms["img_prev_width"], "max_height" => $phpwcms["img_prev_height"], "thumb_name" => md5($row["article_image"]['hash'] . $phpwcms["img_prev_width"] . $phpwcms["img_prev_height"] . $phpwcms["sharpen_level"] . $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]; $content['images']['article']['zoom'] = array('width' => $img_zoom_width, 'height' => $img_zoom_height, 'src' => $img_zoom_rel); $popup_img = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]); if (!empty($caption[2][0])) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $popup_img; $return_false = 'return false;'; } if (empty($row["article_image"]["lightbox"])) { $thumb_href = '<a href="' . $popup_img . '" onclick="window.open(\'' . $open_link; $thumb_href .= "','previewpic','width=" . $zoominfo[1] . ",height=" . $zoominfo[2] . "');" . $return_false; $thumb_href .= '"'; if (!empty($caption[2][1])) { $thumb_href .= $caption[2][1]; } $thumb_href .= ' class="' . $template_default['classes']['image-zoom'] . '">';
$list_img_temp .= $list_img_style; } else { $list_img_style = ''; $list_ahref_style = ''; } $list_img_temp .= $thumb_image[3] . ' alt="' . $caption[1] . '"'; if ($caption[3]) { $caption[3] = html_specialchars($caption[3]); $list_img_temp .= ' title="' . $caption[3] . '"'; } $list_img_temp .= ' class="' . $template_default['classes']['image-thumb'] . '" />'; $img_a = ''; $lightbox_capt = ''; if ($image['zoom'] && isset($zoominfo) && $zoominfo != false) { // if click enlarge the image $open_popup_link = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]); if ($caption[2][0]) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $open_popup_link; $return_false = 'return false;'; } if ($image['lightbox'] && $capt_cur) { $lightbox_capt = 'title="' . parseLightboxCaption($capt_cur) . '" '; } if (!$image['lightbox'] || $caption[2][0]) { $img_thumb_link = '<a href="' . $open_link . "\" onclick=\"checkClickZoom();clickZoom('" . $open_popup_link . "','previewpic','width="; $img_thumb_link .= $zoominfo[1] . ",height=" . $zoominfo[2] . "');" . $return_false . '"' . $caption[2][1]; $img_thumb_link .= $list_ahref_style . ' class="' . $template_default['classes']['image-zoom'] . '">'; $img_a .= $img_thumb_link;
function imagelisttable($imagelist, $rand = "0:0:0:0", $align = 0, $type = 0) { // build imagelist or ecard chooser table // image: type = 0 // ecard: type = 1 $template_type = $type ? 'ecard' : 'imagelist'; $usetable = !isset($imagelist['usetable']) || $imagelist['usetable'] ? true : false; if (empty($GLOBALS['cnt_image_lightbox'])) { $lightbox = 0; } else { $lightbox = generic_string(5); } $caption_on = empty($imagelist['nocaption']) ? true : false; $crop = empty($imagelist['crop']) ? 0 : 1; $image_border = ' border="' . (empty($GLOBALS["template_default"]["article"][$template_type . "_border"]) ? '0' : $GLOBALS["template_default"]["article"][$template_type . "_border"]) . '"'; if ($usetable) { $table_class = $GLOBALS["template_default"]["article"][$template_type . "_table_class"]; if (empty($align)) { $align = ''; } else { $table_class .= ' ' . $GLOBALS['template_default']['classes']['image-list-table'] . $align; $align = ' align="' . $align . '"'; } $table_class = ' class="' . trim($table_class) . '"'; $table_bgcolor = empty($GLOBALS["template_default"]["article"][$template_type . "_table_bgcolor"]) ? '' : ' bgcolor="' . $GLOBALS["template_default"]["article"][$template_type . "_table_bgcolor"] . '"'; $image_align = empty($GLOBALS["template_default"]["article"][$template_type . "_align"]) ? '' : ' align="' . $GLOBALS["template_default"]["article"][$template_type . "_align"] . '"'; $image_valign = empty($GLOBALS["template_default"]["article"][$template_type . "_valign"]) ? '' : ' valign="' . $GLOBALS["template_default"]["article"][$template_type . "_valign"] . '"'; $image_class = empty($GLOBALS["template_default"]["article"][$template_type . "_class"]) ? '' : ' class="' . $GLOBALS["template_default"]["article"][$template_type . "_class"] . '"'; $image_bgcolor = empty($GLOBALS["template_default"]["article"][$template_type . "_bgcolor"]) ? '' : ' bgcolor="' . $GLOBALS["template_default"]["article"][$template_type . "_bgcolor"] . '"'; $caption_class = empty($GLOBALS["template_default"]["article"][$template_type . "_caption_class"]) ? '' : ' class="' . $GLOBALS["template_default"]["article"][$template_type . "_caption_class"] . '"'; $caption_bgcolor = empty($GLOBALS["template_default"]["article"][$template_type . "_caption_bgcolor"]) ? '' : ' bgcolor="' . $GLOBALS["template_default"]["article"][$template_type . "_caption_bgcolor"] . '"'; $caption_valign = empty($GLOBALS["template_default"]["article"][$template_type . "_caption_valign"]) ? '' : ' valign="' . $GLOBALS["template_default"]["article"][$template_type . "_caption_valign"] . '"'; $caption_align = empty($GLOBALS["template_default"]["article"][$template_type . "_caption_align"]) ? '' : ' align="' . $GLOBALS["template_default"]["article"][$template_type . "_caption_align"] . '"'; $image_imgclass = empty($GLOBALS["template_default"]["article"][$template_type . "_imgclass"]) ? '' : ' class="' . $GLOBALS["template_default"]["article"][$template_type . "_imgclass"] . '"'; $capt_before = $GLOBALS["template_default"]["article"][$template_type . "_caption_before"]; $capt_after = $GLOBALS["template_default"]["article"][$template_type . "_caption_after"]; } else { $image_imgclass = ' class="' . $imagelist['class_image_thumb'] . '"'; } $rand = explode(":", $rand); if (count($rand)) { foreach ($rand as $key => $value) { $rand[$key] = intval($value); } } else { $rand = array(0, 0, 0, 0); } $col_rand = $rand[2] && $rand[3] ? 2 : ($rand[2] || $rand[3] ? 1 : 0); if ($count_images = count($imagelist['images'])) { // randomize image if (!empty($imagelist['random'])) { shuffle($imagelist['images']); } if (empty($imagelist['limit'])) { $imagelist['limit'] = 0; } //Tabelle starten $table = LF; if ($usetable) { $table .= ' <table border="0" cellspacing="0" cellpadding="0"' . $align . $table_bgcolor . $table_class . ' summary="">' . LF; } else { $table .= ' <div class="'; if (empty($imagelist['class'])) { $table .= 'image-table'; } else { $table .= $imagelist['class']; } $table .= '">' . LF; } $x = 0; $y = 0; $z = 0; foreach ($imagelist['images'] as $key => $value) { if (isset($imagelist['width'])) { $imagelist['images'][$key][4] = $imagelist['width']; $imagelist['images'][$key][5] = $imagelist['height']; } $y++; if ($usetable && $z && $x == 1) { if ($col_space) { $table .= LF . '<tr>' . LF . ' <td'; $table .= $col_total > 1 ? " colspan=\"" . $col_total . "\"" : ""; if (!empty($GLOBALS["template_default"]['article']['imagelist_spacerrow_class'])) { $table .= ' class="' . $GLOBALS["template_default"]['article']['imagelist_spacerrow_class'] . '">'; $table .= spacer(1, 1) . '</td>' . LF . '</tr>' . LF; } else { $table .= '>' . spacer(1, $col_space) . '</td>' . LF . '</tr>' . LF; } } } if ($usetable && !$x) { //Some default values $col_space = $imagelist['space']; //Space between images $col_count = $imagelist['col']; //columns $col_total = $col_count + ($col_space ? $col_count - 1 : 0) + $col_rand; //Wenn oberer Rand definiert if ($rand[0]) { $table .= '<tr>' . LF . ' <td' . ($col_total > 1 ? ' colspan="' . $col_total . '"' : '') . '>' . spacer(1, $rand[0]) . '</td>' . LF . '</tr>' . LF; } $x = 1; } if ($usetable && $x == 1) { // if left border $table_tmp = $rand[2] ? ' <td width="' . $rand[2] . '">' . spacer($rand[2], 1) . '</td>' . LF : ''; //Neue Tabellenzeile $capt_tmp = ''; $capt_row = '<tr>' . LF . $table_tmp; if ($caption_on) { $table .= $capt_row; } else { $table .= '<tr>' . LF; } } //Aktuelle Bildspalte ausgeben if ($usetable) { $table .= ' <td' . $image_align . $image_valign . $image_bgcolor . $image_class . '>'; } else { if (!$x) { $x = 1; } $table .= ' <div class="' . $imagelist['class_image_wrapper']; if ($x === 1) { $table .= ' first'; } $table .= ' row-' . ($z + 1); $table .= '">' . LF . ' '; } $thumb_image = get_cached_image(array("target_ext" => $imagelist['images'][$key][3], "image_name" => $imagelist['images'][$key][2] . '.' . $imagelist['images'][$key][3], "max_width" => $imagelist['images'][$key][4], "max_height" => $imagelist['images'][$key][5], "thumb_name" => md5($imagelist['images'][$key][2] . $imagelist['images'][$key][4] . $imagelist['images'][$key][5] . $GLOBALS['phpwcms']["sharpen_level"] . $crop . $GLOBALS['phpwcms']['colorspace']), 'crop_image' => $crop)); if ($thumb_image && $imagelist['zoom']) { $zoominfo = get_cached_image(array("target_ext" => $imagelist['images'][$key][3], "image_name" => $imagelist['images'][$key][2] . '.' . $imagelist['images'][$key][3], "max_width" => $GLOBALS['phpwcms']["img_prev_width"], "max_height" => $GLOBALS['phpwcms']["img_prev_height"], "thumb_name" => md5($imagelist['images'][$key][2] . $GLOBALS['phpwcms']["img_prev_width"] . $GLOBALS['phpwcms']["img_prev_height"] . $GLOBALS['phpwcms']["sharpen_level"] . $GLOBALS['phpwcms']['colorspace']))); } // now try to build caption and if neccessary add alt to image or set external link for image $caption = getImageCaption($imagelist['images'][$key][6]); // set caption and ALT Image Text for imagelist $capt_cur = !$type ? html_specialchars($caption[0]) : $caption[0]; $caption[3] = empty($caption[3]) ? '' : ' title="' . html_specialchars($caption[3]) . '"'; //title $caption[1] = empty($caption[1]) ? html_specialchars($imagelist['images'][$key][1]) : html_specialchars($caption[1]); $list_img_temp = '<img src="' . PHPWCMS_IMAGES . $thumb_image[0] . '" ' . $thumb_image[3] . $image_border . $image_imgclass; $list_img_temp .= ' data-image-id="' . $imagelist['images'][$key][0] . '" data-image-hash="' . $imagelist['images'][$key][2] . '"'; $list_img_temp .= ' data-image-ext="' . $imagelist['images'][$key][3] . '"'; $list_img_temp .= ' alt="' . $caption[1] . '"' . $caption[3] . ' />'; if ($imagelist['zoom'] && isset($zoominfo) && $zoominfo != false) { // if click enlarge the image $open_popup_link = 'image_zoom.php?' . getClickZoomImageParameter($zoominfo[0] . '?' . $zoominfo[3]); if ($caption[2][0]) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $open_popup_link; $return_false = 'return false;'; } if (!$lightbox || $caption[2][0]) { $table .= "<a href=\"" . $open_link . "\" onclick=\"checkClickZoom();clickZoom('" . $open_popup_link . "','previewpic','width="; $table .= $zoominfo[1] . ",height=" . $zoominfo[2] . "');" . $return_false . '"' . $caption[2][1] . ' class="' . $imagelist['class_image_zoom'] . '">'; } else { // lightbox $table .= '<a href="' . PHPWCMS_IMAGES . $zoominfo[0] . '" rel="lightbox[' . $lightbox . ']"'; if ($capt_cur) { $table .= ' title="' . parseLightboxCaption($capt_cur) . '"'; } $table .= ' class="' . $imagelist['class_image_lightbox'] . '">'; } $table .= $list_img_temp . "</a>"; } else { // if not click enlarge if ($caption[2][0]) { $table .= '<a href="' . $caption[2][0] . '"' . $caption[2][1] . ' class="' . $imagelist['class_image_link'] . '">' . $list_img_temp . '</a>'; } else { $table .= $list_img_temp; } } if ($usetable) { $table .= '</td>' . LF; if ($caption_on && $capt_cur) { $capt_tmp .= $capt_cur; $capt_cur = '<span style="width:' . $thumb_image[1] . 'px">' . $capt_cur . '</span>'; } else { $capt_cur = ' '; } $capt_row .= ' <td' . $caption_valign . $caption_align . $caption_bgcolor . $caption_class . '>' . $capt_before . $capt_cur . $capt_after . '</td>' . LF; } else { if ($caption_on && $capt_cur) { $caption_class = empty($GLOBALS["template_default"]["article"]["image_caption_class"]) ? 'caption' : $GLOBALS["template_default"]["article"]["image_caption_class"]; $table .= LF . ' <p style="width:' . $thumb_image[1] . 'px" class="' . $caption_class . '">' . $GLOBALS["template_default"]["article"]["image_caption_before"]; $table .= $capt_cur; if ($caption[4] !== '') { $table .= ' <span class="' . $GLOBALS['template_default']['classes']['copyright'] . '">' . html_specialchars($caption[4]) . '</span>'; } $table .= $GLOBALS["template_default"]["article"]["image_caption_after"] . "</p>"; } $table .= LF . ' </div>' . LF; } //Gegenchecken wieviele Tabellenspalten als Rest bleiben und ergänzen if ($usetable) { if ($y == $count_images && $col_count > 1) { //wenn eigentlich alle Bilder durchlaufen sind if ($col_space && $x < $col_count) { $xct = ' <td>' . spacer($col_space, 1) . '</td>' . LF; $table .= $xct; $capt_row .= $xct; } $rest_image = ceil($count_images / $col_count) * $col_count - $count_images; for ($i = 1; $i <= $rest_image; $i++) { $table .= ' <td> </td>'; $capt_row .= ' <td> </td>'; if ($i < $rest_image) { if ($col_space) { $xct = ' <td width="' . $col_space . '">' . spacer($col_space, 1) . '</td>' . LF; $table .= $xct; $capt_row .= $xct; } } $x++; } } if ($x == $col_count) { //Wenn maximale Anzahl Bildspalten erreicht $xct = $rand[3] ? '<td width="' . $rand[3] . '">' . spacer($rand[3], 1) . '</td>' . LF : ''; $table .= $xct; $capt_row .= $xct; $table .= "</tr>" . LF; $capt_row .= "</tr>" . LF; if ($capt_tmp) { if ($caption_on) { $table .= $capt_row; } $capt_row = ''; $capt_tmp = ''; } $x = 1; $z++; } else { $xct = $col_space ? ' <td width="' . $col_space . '">' . spacer($col_space, 1) . '</td>' . LF : ''; $table .= $xct; $capt_row .= $xct; $x++; } } else { if ($x == $imagelist['col']) { $x = 0; $z++; } else { $x++; } } // end if max image count if ($imagelist['limit'] == $y) { break; } } if ($usetable) { if ($rand[1]) { $table .= '<tr>' . LF . ' <td' . ($col_total > 1 ? " colspan=\"" . $col_total . "\"" : "") . ">" . spacer(1, $rand[1]) . '</td>' . LF . '</tr>' . LF; } $table .= ' </table>' . LF; } else { $table .= ' </div>' . LF; } } return $table; }
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; }