} } // redirect to login form if user is not logged in and has no permission to access level if (!PERMIT_ACCESS && !_getFeUserLoginStatus()) { if (!empty($block['feloginurl'])) { $template_default['login_form_url'] = str_replace('{SITE}', PHPWCMS_URL, $block['feloginurl']); } elseif (empty($template_default['login_form_url'])) { $template_default['login_form_url'] = PHPWCMS_URL; } // store current URL $_SESSION['LOGIN_REDIRECT'] = decode_entities(FE_CURRENT_URL); // redirect to login form headerRedirect($template_default['login_form_url'], 401); } //reads all articles for active cat into array $content["articles"] = get_actcat_articles_data($content["cat_id"]); $content["article_list_count"] = count($content["articles"]); // generating a list of articles inside the current article category if (!$aktion[4]) { if ($content['404error']['status'] === false && ($content["article_list_count"] || $content['struct'][$content['cat_id']]['acat_topcount'] == -1)) { $content['opengraph']['type'] = 'article'; if ($content['struct'][$content['cat_id']]['acat_topcount'] == -1 || $content["article_list_count"] === 1 && empty($template_default['settings']['force_article_list_mode'])) { // if($temp_counter == 1) { // 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;
/** * Return menu or menu elements based on article menu title information * starting at given structure level ID, limited to single level (non-nested) * * @return mixed (array/string) * @param array **/ function getArticleMenu($data = array()) { global $content; global $aktion; $defaults = array('level_id' => 0, 'class_active' => array(0 => 'active', 1 => ''), 'wrap_title_prefix' => '', 'wrap_title_suffix' => '', 'item_prefix' => "\t", 'item_suffix' => '', 'sort' => 'level', 'item_tag' => 'li', 'wrap_tag' => 'ul', 'attribute_wrap_tag' => '', 'class_item_tag' => '', 'class_first_item_tag' => '', 'class_last_item_tag' => '', 'return_format' => 'string', 'articlemenu_options' => array('enable' => false, 'image' => false, 'text' => false, 'width' => 0, 'height' => 0, 'crop' => 0, 'textlength' => 0, 'position' => 'inside', 'template' => '<span class="amenu-extended">[IMAGE]<img src="{IMAGE}" alt="{IMAGE_NAME}" />[/IMAGE][TEXT]<span class="p">{TEXT}</span>[/TEXT]</span>')); $data = is_array($data) && count($data) ? array_merge($defaults, $data) : $defaults; $li = array(); $articles = get_actcat_articles_data($data['level_id']); $key = 0; $total = count($articles) - 1; foreach ($articles as $item) { $class = ''; $class_a = ''; if ($data['class_item_tag']) { $class .= $data['class_item_tag'] . ' '; } if ($key === 0 && $data['class_first_item_tag']) { $class .= $data['class_first_item_tag'] . ' '; } elseif ($key === $total && $data['class_last_item_tag']) { $class .= $data['class_last_item_tag'] . ' '; } if ($item['article_id'] == $aktion[1]) { if (!empty($data['class_active'][0])) { $class .= $data['class_active'][0] . ' '; } if (!empty($data['class_active'][1])) { $class_a = ' class="' . $data['class_active'][1] . '"'; // set active link class } } $class = trim($class); $item['outside'] = ''; $item['inside'] = ''; if ($data['articlemenu_options']['enable']) { $item['img_src'] = ''; $item['img_name'] = ''; $item['amenu_text'] = ''; if ($data['articlemenu_options']['image'] && (!empty($item['article_image']['list_id']) || !empty($item['article_image']['id']))) { if (!empty($item['article_image']['list_usesummary']) && !empty($item['article_image']['id'])) { $item['img_src'] = $item['article_image']['hash'] . '.' . $item['article_image']['ext']; $item['img_name'] = html($item['article_image']['name']); } elseif (!empty($item['article_image']['list_id'])) { $item['img_src'] = $item['article_image']['list_hash'] . '.' . $item['article_image']['list_ext']; $item['img_name'] = html($item['article_image']['list_name']); } if ($item['img_src']) { $item['img_src'] = 'x' . $data['articlemenu_options']['height'] . 'x' . $data['articlemenu_options']['crop'] . '/' . $item['img_src']; $item['img_src'] = 'img/cmsimage.php/' . $data['articlemenu_options']['width'] . $item['img_src']; } } if ($data['articlemenu_options']['text']) { switch ($data['articlemenu_options']['text']) { case 'description': $item['amenu_text'] = html(getCleanSubString($item['article_description'], abs($data['articlemenu_options']['textlength']), $GLOBALS['template_default']['ellipse_sign'], $data['articlemenu_options']['textlength'] < 0 ? 'char' : 'word')); break; case 'menutitle': $item['amenu_text'] = html(getCleanSubString($item['article_menutitle'], abs($data['articlemenu_options']['textlength']), $GLOBALS['template_default']['ellipse_sign'], $data['articlemenu_options']['textlength'] < 0 ? 'char' : 'word')); break; case 'teaser': if ($data['articlemenu_options']['textlength'] === 'HTML') { $item['amenu_text'] = $item['article_summary']; } else { $item['amenu_text'] = trim(strip_tags($item['article_summary'])); $item['amenu_text'] = getCleanSubString($item['amenu_text'], abs($data['articlemenu_options']['textlength']), $GLOBALS['template_default']['ellipse_sign'], $data['articlemenu_options']['textlength'] < 0 ? 'char' : 'word'); } break; } } $item[$data['articlemenu_options']['position']] = $data['articlemenu_options']['template']; $item[$data['articlemenu_options']['position']] = str_replace('{IMAGE_NAME}', $item['img_name'], $item[$data['articlemenu_options']['position']]); $item[$data['articlemenu_options']['position']] = render_cnt_template($item[$data['articlemenu_options']['position']], 'IMAGE', $item['img_src']); $item[$data['articlemenu_options']['position']] = render_cnt_template($item[$data['articlemenu_options']['position']], 'TEXT', $item['amenu_text']); } $li[$key] = $data['item_prefix'] . '<' . $data['item_tag'] . ($class != '' ? ' class="' . $class . '"' : '') . '>'; $li[$key] .= '<a href="' . rel_url(array(), array('newsdetail'), setGetArticleAid($item)) . '"' . $class_a . '>'; $li[$key] .= $data['wrap_title_prefix']; $li[$key] .= html(getArticleMenuTitle($item)); $li[$key] .= $data['wrap_title_suffix']; $li[$key] .= $item['inside']; $li[$key] .= '</a>'; $li[$key] .= $item['outside']; $li[$key] .= '</' . $data['item_tag'] . '>' . $data['item_suffix']; $key++; } if ($data['wrap_tag'] && count($li)) { array_unshift($li, '<' . trim($data['wrap_tag'] . ' ' . trim($data['attribute_wrap_tag'])) . '>'); array_push($li, '</' . $data['wrap_tag'] . '>'); } return $data['return_format'] == 'string' ? implode(LF, $li) : $li; }